October 31, 200817 yr Newbies I'm trying to figure out how to tell if a word/phrase/text string is the 1st word/phrase/text string, 2nd or 3rd in a list. I need a number (1-3) returned. It's after midnight and my brain is spinning circles...everything i've tried returns me either text or the the character position. Help, is there a way? Ginger
October 31, 200817 yr Check out the "PositionValue" CF by Geoff Wells. http://www.briandunning.com/cf/62 If you have a list... Apple Banana Pumpkin ...and you ask for the "PositionValue" of Banana, it will return 2.
October 31, 200817 yr Your question is not quite clear. Assuming that by "list" you mean text items separated by carriage returns ("values" in Filemakerese), you can get the ordinal number of a given value in the list by: ValueCount ( Left ( listOfValues ; Position ( ¶ & listOfValues & ¶ ; ¶ & searchValue & ¶ ; 1 ; 1 ) ) Note that this returns the "value position" of the FIRST occurrence of searchValue in listOfValues.
October 31, 200817 yr Author Newbies Thank you for such a quick response! You guys, make it looks so easy! It makes sense now, don't know why I couldn't pull that out last night...! That is exactly what I needed AND it introduces me to a new function. I'm coming from FM5.5 and trying figure out some of the new (and old) functions. I haven't any experience with the "Let" fuction, but I like it! especially for testing out how other functions works...it keeps the other code cleaner ...it can get confusing quickly with nested functions. Thank you, again.
October 31, 200817 yr Author Newbies I knew there was something about the carriage returns (I didn't have/wasn't adding a carriage return to the beginning and the end of the list)! I just couldn't grasp what I needed to do. I had looked at all the functions you used, but not in that combination and I *just* couldn't get it last night! Thanks for making it looks so easy! :
Create an account or sign in to comment