stuj1026 Posted December 2, 2009 Share Posted December 2, 2009 Hi Everyone! I am new to recursive functions and need some help I am setting a global field using the function (field names) in a file called "test" that has a relationship to another file called "test2" It generates something that looks like this into the global field based on the fields on the layout field1 field2 field3 field4 test2::first_name test2::last_name test2::zip_code field 1, 2, 3 and 4 are on the layout and are part of the test database and test2::first_name, test2::last_name and test2::zip_code are related fields on the same layout I need to strip away the test2: from the global field so I am left with field1 field2 field3 field4 first_name last_name zip_code I need this to work in a recursive function as opposed to using a script to loop thru the global. It's a little tricky! Can anyone help Thanks in advance Stu Link to comment Share on other sites More sharing options...
TheTominator Posted December 2, 2009 Share Posted December 2, 2009 Would a simple statement like this work? No recursion required from what I can see. Substitute(originalText; "test2::"; "") Link to comment Share on other sites More sharing options...
stuj1026 Posted December 2, 2009 Author Share Posted December 2, 2009 (edited) thanks for the quick reply.. I explained my problem in a simplified form. Yes the substitute function will work but this has to work across many layouts with many different realationships on those layouts. so on 1 layout it might be field1 field2 field3 field4 test2::first_name test2::last_name test2::zip_code and on another it might be field1 field2 field3 field4 test3::first_name agents::last_name billing::zip_code Their are just to many combination for me to use the substitute function on. thats why im looking for a recursive function.. Thanks again Edited December 2, 2009 by Guest Link to comment Share on other sites More sharing options...
comment Posted December 2, 2009 Share Posted December 2, 2009 Try something like this (untested) MyFunction ( listOfFields ) = Let ( [ field = GetValue ( listOfFields ; 1 ) ; countFields = ValueCount ( listOfFields ) ] ; RightValues ( Substitute ( field ; "::" ; ¶ ) ; 1 ) & Case ( countFields > 1 ; MyFunction ( RightValues ( listOfFields ; countFields - 1 ) ) ) ) Link to comment Share on other sites More sharing options...
stuj1026 Posted December 2, 2009 Author Share Posted December 2, 2009 Thank you Thank You!! Works like a charm! Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 5266 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