R2D2 Posted January 1, 2020 Share Posted January 1, 2020 hi! I couldn't find a better area for this topic. But I have a variable $RowList which is defined to contain numerical values in List(FieldA; FieldB; FieldC; FieldD,..., FieldK). That is inside a Loop ($i as a counter). I would like to do some testing for each of them in turn (like: If (GetValue($RowList; $i) > x) then set $RowList value $i to something else). And then return the modified whole list back to a variable. Is that possible? Link to comment Share on other sites More sharing options...
comment Posted January 1, 2020 Share Posted January 1, 2020 To replace a value at index position in listOfValues, you can use: LeftValues ( listOfValues ; index - 1 ) & replacementValue & ¶ & RightValues ( listOfValues ; ValueCount ( listOfValues ) - index ) Note that the result will have a trailing ¶. Link to comment Share on other sites More sharing options...
bcooney Posted January 1, 2020 Share Posted January 1, 2020 A good custom function to add to your file. https://www.briandunning.com/cf/2169 Link to comment Share on other sites More sharing options...
comment Posted January 1, 2020 Share Posted January 1, 2020 49 minutes ago, bcooney said: A good custom function to add to your file. https://www.briandunning.com/cf/2169 That function performs a task that is fundamentally different from the one required here (at least the way I understood it). Link to comment Share on other sites More sharing options...
bcooney Posted January 1, 2020 Share Posted January 1, 2020 Yes, sorry read too quickly. Link to comment Share on other sites More sharing options...
R2D2 Posted January 3, 2020 Author Share Posted January 3, 2020 Thank you comment and bcooney! The way, comment showed, is what I need. But this custom function is also very useful for me.👍 Link to comment Share on other sites More sharing options...
comment Posted January 3, 2020 Share Posted January 3, 2020 (edited) Note also that if you're looping over a list of values, you can add each processed value to a new list in another variable, say: Set Variable [ $result ; List ( $result; If ( GetValue ( $RowList ; $i ) > $x ; "a" ; "b" ) ) ] Edited January 3, 2020 by comment Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 1569 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