Himitsu Posted December 20, 2005 Posted December 20, 2005 I have a loop function that has an "end loop if Afield =valueListItem ("student" ; "school location") but it seems not to work... it keeps on looping like the value is false.... any hints?
SlimJim Posted December 20, 2005 Posted December 20, 2005 ValueListItems returns a list of values. If you want to check that a field is equal to one of the values then you need to check that it is in the lis. For example PatternCount(Afield;ValueListItems("student";"school location")) > 0 should normally work, but, if there is a possibility of Afield being actually within one of the values then you may have to add in some extra carriage returns to ensure that you are checking for a complete value: PatternCount("¶" & Afield & "¶";"¶" & ValueListItems("student";"school location") & "¶")> 0 There may be simpler ways of doing this, if so it would be nice to see them.
Himitsu Posted December 20, 2005 Author Posted December 20, 2005 Hmm... I tried both of those... it did the same thing... I can understand the patterncount, but I wondering why it doesn't work...
Søren Dyhr Posted December 20, 2005 Posted December 20, 2005 There could be some syntactical things wrong, I do always make the first parameter in the function a Get ( FileName ) instead of hardwirering. Next thing that comes to mind is if the field the valuelist is basede on can't be indexed, will the valuelist be very very short : But it surprises me that a school location only exists in a valuelist, is it a dynamic valuelist?? If so couldn't a multicriteria relation ship be used instead to establish a IsValid[ http://www.filemaker.com/help/FunctionsRef-311.html ...which is almost, if not quite the same as you "Help" throws up! To me is VL's here a convoluted way of establishing a membership of a found set of records. --sd
Himitsu Posted December 20, 2005 Author Posted December 20, 2005 well, I know the valulist is coming from another file not table. And it is just a list not from a field... however, I am going to change that and make a new table in the same file that allows the user to add a school location as a new record. Then I will base the valuelist off that field from that table. Let me set that up first and see if it functions better that way.
Søren Dyhr Posted December 20, 2005 Posted December 20, 2005 Not quite nessersary, just move the valuelist defintion to the file where the script runs, and reference it instead of the valuelist in the other file. --sd
Himitsu Posted December 20, 2005 Author Posted December 20, 2005 well, I just made a custom value list with two items, A and B and that field is a global but uses the same valuelist... still nothing.
Himitsu Posted December 20, 2005 Author Posted December 20, 2005 now I just changed the name of the file to the Get(filename) instead.. nothing! still remains in the loop. I know the calculation has to be a bolean, so I am thinking Afield has to = something from the valuelist. Sounds easy...
Søren Dyhr Posted December 20, 2005 Posted December 20, 2005 You can't build valuelist with globals due to the lack of indexes, could you make a small template for us to investigate without japanese signs??? --sd
Himitsu Posted December 21, 2005 Author Posted December 21, 2005 well, the value isn't coming from a field. The list is a custom value. The field that the endloop if function is a global. I will make just a simple layer using it and post it.
Himitsu Posted December 21, 2005 Author Posted December 21, 2005 Ok here is a simple version of it. Same syntax I used, just removed the other bits around it. valueListValidate.zip
SlimJim Posted December 21, 2005 Posted December 21, 2005 Hi Himitsu Many apologies for failing to see this earlier but I console myself with the thought that I am not the only one who missed it. The PatternCount function has it's parameters the wrong way round. In your sample use: Exit loop If[ PatternCount (ValueListItems (Get ( FileName ) ; "school location" );valueListValidate::location_G )]
Himitsu Posted December 21, 2005 Author Posted December 21, 2005 Thanks a ton!!! I put that in and great! Worked GREAT!
Recommended Posts
This topic is 6977 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