December 20, 200520 yr 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?
December 20, 200520 yr 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.
December 20, 200520 yr Author Hmm... I tried both of those... it did the same thing... I can understand the patterncount, but I wondering why it doesn't work...
December 20, 200520 yr 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
December 20, 200520 yr Author 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.
December 20, 200520 yr 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
December 20, 200520 yr Author 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.
December 20, 200520 yr Author 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...
December 20, 200520 yr 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
December 21, 200520 yr Author 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.
December 21, 200520 yr Author Ok here is a simple version of it. Same syntax I used, just removed the other bits around it. valueListValidate.zip
December 21, 200520 yr 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 )]
Create an account or sign in to comment