David Nelson Posted August 12, 2013 Posted August 12, 2013 There is a script inside of which are these lines: Set Variable [$filterValue ; Value: Evaluate($quickFindField) If [ $filterValue <> "" and $filterValue <> "?"] ... do the actions So is this just a short or another way of writing If [ not IsEmpty($filterValue) and IsValid($filterValue) ?? I want to be sure I am not missing a different or additional meaning behind it and I can learning something else I did not know. Thank you.
bcooney Posted August 18, 2013 Posted August 18, 2013 I agree with your interpretation and I also vote +1 for your style. 1
David Nelson Posted August 21, 2013 Author Posted August 21, 2013 Hi bcooney, Your name is Barbara, right? Thank you so much for responding. I could not figure how to test the IsValid in that script so I was unsure if it meant same thing as the calc example (<> "?"). So at least knowing they are same, I can probably move to other things for now but I sure would like to know how to test that. I've read help clean through now twice and I still feel clueless about this stuff. On another question, if I want to use GetSummary(), how can I specify the sort order for the break field inside it? I find nothing when I search. It just sorts ascending as far as I can tell.
bcooney Posted August 21, 2013 Posted August 21, 2013 Hi David, Looking again at the script snippet, I wonder what it's doing. Is the intention to enter a value in a field and perform QuickFind? All one has to do is use the Perform QuickFind script step and feed it the global field in which the user enters their search criteria. Sorting with GetSummary( ) is not something I'm familiar with. I would bet that there is not control over sort order. Tell us more of the functionality that you're trying to accomplish. Perhaps we'll suggest a more direct approach. ~Barbara
Fitch Posted August 21, 2013 Posted August 21, 2013 There is a script inside of which are these lines: Set Variable [$filterValue ; Value: Evaluate($quickFindField) If [ $filterValue <> "" and $filterValue <> "?"] ... do the actions So is this just a short or another way of writing If [ not IsEmpty($filterValue) and IsValid($filterValue) ?? I want to be sure I am not missing a different or additional meaning behind it and I can learning something else I did not know. Thank you. I'm not sure what "Master Detail" means here, but IMO it's preferable to use the not IsEmpty() syntax. In fact, I'd just write not IsEmpty($quickFindField) and be done with it. I don't think Evaluate is necessary -- the Find will tell you whether the search term was valid. By the way, IsValid($filterValue) will always return 1 (true), because both empty and "?" are valid. 1
LaRetta Posted August 21, 2013 Posted August 21, 2013 That script snip is from Master Detail by Todd Geist here: http://www.modularfilemaker.org/2013/03/master-detail/
Fitch Posted August 21, 2013 Posted August 21, 2013 Ah, yes, thanks. Still not sure what you could put in the "quickfind" field that would be invalid.
bruceR Posted August 21, 2013 Posted August 21, 2013 Looking at the file, $quickFindField should return the NAME of the field; not its contents. S The purpose of the test is to see whether the developer set up a field with the required object name. According to the comment: # we are looking for the Field that is used for Quick Find Entry # It should be global field on this layout and it should have a layout object name, "MasterDetailQuickFind" 1
David Nelson Posted August 21, 2013 Author Posted August 21, 2013 Sorry, I thought everyone knew Master Detail. Tom said, "By the way, IsValid($filterValue) will always return 1 (true), because both empty and "?" are valid." So then IsValid would not be the same as $filterValue <> "?" and empty field is why I was having trouble. Thank you for helping. Help says: Returns 0 (False) if the data is invalid and 1 (True) if the data is valid. So is this a true statement please? an empty field is valid and would always be valid no matter the data type and it can only evaluate a field as NOT valid when it actually contains something. Ah!! Thank you, Bruce. So the variable would be valid with a ? in it! I will test. Seems if there is not an object name attached to the field we must look for the ? specifically. Since Mr. Geist is a top developer, I figured he knew the difference which is why I wanted to pin down the reasoning. I figured there was reason for not using EvaluationError or IsValid but I couldn't figure it out since IsValid wouldn't fail for me. Forgive my ignorance. FileMaker feels like a jigsaw puzzle and I'm given all the pieces and they can begin to fit together but there is no picture on the box of what the result is supposed to look like so sometimes I just insert pieces to see if they fit.
David Nelson Posted August 21, 2013 Author Posted August 21, 2013 Wait. IsValid also can work if the field does not exist at all as in related field or table. This means (to me) then that IsValid is very limited in its use and I would need to be careful to understand how it will evaluate. I know! It would work well to know if there is a related record before a Go To Related Record step.
Fitch Posted August 22, 2013 Posted August 22, 2013 IsValid is for testing whether data is valid. Don't use it to test for related records. There might be a related record with invalid data. Instead, use IsEmpty( related::keyfield ). IsValid is only meaningful when tested against data. In the example above, $filterValue already contains the result of the Evaluate expression. If a "?" was returned, then we know Evaluate returned an invalid result. But the question mark itself is perfectly "valid." In other words, Evaluate ( "some nonsense" ) // returns ? IsValid( Evaluate ( "some nonsense" ) ) // returns 0, it was not valid vs. SetVariable[ $result ; Evaluate ( "some nonsense" ) ] // variable now contains ? IsValid( $result ) // returns 1, a question mark is a valid text string That's why the Master Detail script doesn't use the latter construction, but rather tests explicitly for a question mark. Hope that helps. FWIW I rarely use IsValid, I agree that its utility is somewhat limited. Perhaps useful for imported data, since we generally catch invalid data entry using other methods. 2
David Nelson Posted August 22, 2013 Author Posted August 22, 2013 WOW. What a perfect explanation, Tom. And now things become clear. As my daughter says, "fantabulous"!
Recommended Posts
This topic is 4110 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now