FMDuck Posted November 30, 2005 Posted November 30, 2005 I'm trying to build a list of similiar values in one field based on the quantity of values in another field (para. delimited - not repeating field) For example: Field_A = "abc" Field_B = "pqr¶stu¶vwx" //3 values The result should be: Field_C = "abc¶abc¶abc" //3 values of Field_A I want the value in Field_A to be repeated in field_C by the valuecount of Field_B. Thanks.
Zero Tolerence Posted November 30, 2005 Posted November 30, 2005 Custom Function: Set_Reps(Field_A; repNum; currentRep; result) Let([ a = Field_A; b = result; c = GetAsNumber(repNum); d = GetAsNumber(currentRep)]; If( d > c; b; Set_Reps(a; c; d + 1; b & a & "¶")) Then Call it like this Set_Reps(Field_A; PatternCount(Field_B; "¶") + 1; 1; "") Then you only have to worry about removing the trailing return. Didn't get to test it, but it looks pretty close to right. David Singleton.
Raybaudi Posted November 30, 2005 Posted November 30, 2005 Field_B = "pqr¶stu¶vwx" Or, without a recursive custom function, you can try this simple calc: [color:green]Substitute ( Filter ( Field_B & "¶" ; "¶" ) ; "¶" ; Field_A & "¶" ) If Field_B may contain extra carriage returns or empty rows, try this other: [color:green]Substitute ( Filter ( Substitute (TrimAll ( Substitute ( Field_B ; "¶" ; " " );1;0 ) & "¶" ; " " ; "¶" ) ; "¶" ) ; "¶" ; Field_A & "¶" ) :
FMDuck Posted December 1, 2005 Author Posted December 1, 2005 David; You were thinking the same way I was. Daniele: Works great! Thanks to both.
Recommended Posts
This topic is 6930 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