![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Windows: XP FMPro: v6.04 ---------------------- I've searched and couldn't find anything on this in particular, so I'm hoping someone in the community can help... I have a report based on two search criteria that the user specifies, project and project version. Sometimes the user wants a report specific for a project version, other times, they want to know everything that has been written up against the project, regardless of version. Is it possible to direct in the script a different layout that is used for the report based on the validity of the Project version. I've tried the following simple entry: If (Status (CurrentFieldChoice) = "") Go to Layout A else Go to Layout B I've also tried using If (not IsValid(project version) Go to Layout A else Go to Layout B Neither of these are working. Is there a way to make this script work, and why, in my simplistic thinking, is what I tried not working. Thanks to all who help in advance. I really appreciate all the knowledge that I've gathered from help on this group. - Teresa K. |
#3
| |||
| |||
|
|
The IsValid function tests whether the contents of a field are valid: a number in a number field is valid, but text isn't. A date in a date field is valid, but a number isn't (also described in Help). It doesn't know or care whether the project version is, by whatever your definition, valid. |
#4
| |||
| |||
|
|
In article <xOwaf.4176$1u3.3471@trndny05>, "Matt Wills" <I'm (AT) Witz (DOT) end wrote: The IsValid function tests whether the contents of a field are valid: a number in a number field is valid, but text isn't. A date in a date field is valid, but a number isn't (also described in Help). It doesn't know or care whether the project version is, by whatever your definition, valid. I use the IsValid function quite a bit when I need to test for the presence or absence of a matching record in a related file. If I have two files related by KeyField, and I don't know whether or not a record in FileA has a match in FileB (both files add & subtract records by the hundreds all the time), then my scripts do: If ( IsValid(FileB_Relationship::KeyField) ) Do something Else Do something else EndIf I used to use calc fields that would have a one or zero if there was a record match, then test for the presence or absence of a one. But it seems to speed things up using IsValid instead. I stumbled on this by accident and have never seen IsValid discussed being used in this way. It's been working in many apps for quite a while (FM6, served, multi-platform). Anyone know if there is some kind of hidden danger in doing this? Steve Brown |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
[and yes Matt, Status (CurrentFieldChoice) is a valid function in V6.0, but upon further research it is not what I want]. |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
Geez zip... Mea Culpa!!! Let's see... Step one, re-read what I typed Step two, re-read what's in my script Step three, realize I made a huge blunder and then made it again Step four, find a crow and prepare for dinner... followed by foot-in-mouth for dessert. How about Status(CurrentFieldContents) as the script step? Mea Culpa, hope the weekend goes better than this. - Teresa |
#9
| |||
| |||
|
|
Thanks Matt, Steve and Remi. Remi, I also remember reading about using "IsEmpty" or using "not IsEmpty" instead of IsValid, something about IsValid taking a wider swipe at what would be included in a find (I think Lynn Allen was the one that pointed it out.. "As for IsValid, it can fail if you have a relationship based on mismatched field types, or for several other reasons, because basically IsValid is intended to check for fields that require a data type with a specific format (date, time, etc.) or to validate if a field is missing. It is not intended to validate RELATIONSHIPS." |
#10
| |||
| |||
|
|
In article <1131118268.480046.84510 (AT) g14g2000cwa (DOT) googlegroups.com>, "Teresa K." <teresa.kabourek (AT) ngc (DOT) com> wrote: Thanks Matt, Steve and Remi. Remi, I also remember reading about using "IsEmpty" or using "not IsEmpty" instead of IsValid, something about IsValid taking a wider swipe at what would be included in a find (I think Lynn Allen was the one that pointed it out.. "As for IsValid, it can fail if you have a relationship based on mismatched field types, or for several other reasons, because basically IsValid is intended to check for fields that require a data type with a specific format (date, time, etc.) or to validate if a field is missing. It is not intended to validate RELATIONSHIPS." Now you've got me worried. I think I stopped using IsEmpty because I found it would fail with some kinds of fields. That is, if asked to evaluate whether or not a field in a related record was empty or not, should the record itself not be present, the field wouldn't be "empty," it would simply not be there. Also, when using IsEmpty to check whether or not a related record exists, if the field being checked was empty, it would register, when what you wanted to know was whether or not the record itself exists, regardless of any field contents. Checking the key field should work, as there should always be something there. But I get all kinds of oddball data to clean up. You know users ... A typical example of what I might use it for is to get emailed a .csv file of some data. I import this file into a quickie ad hoc FM db, then relate this db to my main db. Now I need to check what records exist in the new file not in the main db. Sometimes I need to check the other way, what records exist in main db not in new import file. IsValid has been doing this job, for me, better than IsEmpty. Steve Brown |
![]() |
| Thread Tools | |
| Display Modes | |
| |