R2D2 Posted January 1, 2020 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?
comment Posted January 1, 2020 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 ¶.
bcooney Posted January 1, 2020 Posted January 1, 2020 A good custom function to add to your file. https://www.briandunning.com/cf/2169
comment Posted January 1, 2020 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).
R2D2 Posted January 3, 2020 Author 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.👍
comment Posted January 3, 2020 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
Recommended Posts
This topic is 1858 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