nesor Posted May 15, 2010 Posted May 15, 2010 I’ve created a variable $inv_check I'd like to use as a multi-dimensional array. While I seem to have created it ok, I’m stuck on extracting values from the array. $inv_check = inv_id & start_date & rate for a list of records. Each set of values is separated by a carriage return. For example: $inv_check= 100 1/1/10 1/5/10 101 1/5/10 1/25/10 106 2/1/10 3/1/10 Now I'd like to be able to run queries on a table using the data from $inv_check. I typically use the GetValue function for simple lists, but can’t seem to get the values past the 1st parameter. How do you extract values past the first parameter? Thanks in advance for the help.
comment Posted May 15, 2010 Posted May 15, 2010 Each set of values is separated by a carriage return. And the values in a set are separated by … ? BTW, your example shows two dates, not a date and a rate.
nesor Posted May 15, 2010 Author Posted May 15, 2010 The 3 values are separated from each other by a tab Each row is separated by a carriage return Sorry for the error in the example. In fact, parameters 2 and 3 are dates. There is no rate.
bruceR Posted May 15, 2010 Posted May 15, 2010 char(9) is the tab character Let([ R = 2 ; //row we want C = 3 ; //column we want thisRow = getValue( $inv_check; R); splitRow = substitute( thisRow; char(9); ¶)]; Getvalue( splitRow; C ) )
bruceR Posted May 15, 2010 Posted May 15, 2010 Or: optional input format - try removing either input Let([ input = "R2C3"; input = 2.1; RC = substitute( input; ["R"; ""];["C"; ¶]; ["."; ¶] ); R = getValue( RC; 1); C = getValue( RC; 2); thisRow = getValue( $inv_check; R); splitRow = substitute( thisRow; char(9); ¶)]; Getvalue( splitRow; C ) )
nesor Posted May 16, 2010 Author Posted May 16, 2010 I'll give this a shot. Thank you so much for the tips.
nesor Posted May 21, 2010 Author Posted May 21, 2010 BruceR - It worked. Now I can get back to coding the rest of the solution. Thank you so much for your help!
Chris Scalzi Posted July 21, 2015 Posted July 21, 2015 @BruceR I just referenced this post for a project I'm working on. Great stuff, and thanks!
dwdata Posted July 21, 2015 Posted July 21, 2015 Haha - I want to help skin the cat ;oP Let([ a = "100 1/1/10 1/5/10¶101 1/5/10 1/25/10¶106 2/1/10 3/1/10"; b = "r3 c1"; c = GetValue(Substitute(GetValue ( a ; Filter ( "0123456789" ; LeftWords(b, 1) )), Char(9), "¶"), Filter ( "0123456789" ; RightWords(b, 1) )) ]; c )
Recommended Posts
This topic is 3412 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