Jonas Löfvenmark Posted January 12, 2012 Posted January 12, 2012 Good day dear FM friends, I have hot stuck on something much trivial - something I though would be a breeze to set up, but apparently not. Please help, dear friends! I thought I could easily find a function similar to GetValue but the other way around. With a valuelist based on cities::id to show cities::name I would need to do something like: getValueListItem("cities value list"; "Paris") to return cities::id. I understand I can use position to find the position in the list, but how about the corresponding id?
comment Posted January 12, 2012 Posted January 12, 2012 Not sure I understand your question. Perhaps you mean something like this? http://www.briandunning.com/cf/908
Jonas Löfvenmark Posted January 12, 2012 Author Posted January 12, 2012 Found it! Thanks for your fast reply though. GetNthRecord ( cities::id ; Position(List(cities::name) ; "Paris" ;0 ;1 ))
comment Posted January 12, 2012 Posted January 12, 2012 GetNthRecord ( cities::id ; Position(List(cities::name) ; "Paris" ;0 ;1 )) That doesn't look right: if your Cities table contains Amsterdam, Paris and Stockholm (in that order), then = Position(List(cities::name) ; "Paris" ;0 ;1 ) will return 11 instead of the 2 you need.
Jonas Löfvenmark Posted January 12, 2012 Author Posted January 12, 2012 I see.... hm. Thought I had id! Kudos to your hawk eyes. Any idea on how to do this? basically an automation of what happends when I manually select a entry in a valuelist that is set to only show the second column.
comment Posted January 12, 2012 Posted January 12, 2012 The CF I linked to earlier will do it. Using the earlier example = CorrespondingValue ( List ( Cities::Name ) ; "Paris" ; List ( Cities::ID ) ) will return the ID of Paris. The function is not recursive, so you could also use its formula directly in your calculation field.
Jonas Löfvenmark Posted January 12, 2012 Author Posted January 12, 2012 Thanks! Will look into that. For now I came up with: getnthrecord( cities::id ; PatternCount(Left( List( cities::name) ; Position( List( cities::name ) ; "Paris" ;0 ;1 )); ¶) +1)
comment Posted January 12, 2012 Posted January 12, 2012 That's very similar to what the function does - except it includes protection against values being contained in other values.
Jonas Löfvenmark Posted January 12, 2012 Author Posted January 12, 2012 Yes, that could be usefull! Thanks for input!! Position( ¶ & List( cities::name ) & ¶ ; ¶ & "Paris" & ¶ ;0 ;1 )
Recommended Posts
This topic is 4699 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