JohannesT 0 Posted September 30, 2014 Report Share Posted September 30, 2014 Hey! So basically I have a list and I'd like to set them new values but when I tried with "set" then it doesn't allow me to put $list item into it. Any ideas? Thanks! Quote Link to post Share on other sites
nuc63 27 Posted September 30, 2014 Report Share Posted September 30, 2014 $List from file or $list from text Quote Link to post Share on other sites
nuc63 27 Posted September 30, 2014 Report Share Posted September 30, 2014 Correction Add list to list%listThen put one of those two commands in second box Quote Link to post Share on other sites
arunner26 51 Posted September 30, 2014 Report Share Posted September 30, 2014 JohannesT,I use a table with one column to do what you are describing. add list to list(%list1, $list from text("A{$new line}B{$new line}C{$new line}", $new line), "Delete", "Global")add list to table as column(&table1, 0, 0, %list1)set table cell(&table1, 1, 0, "D") So in the example above here is how list1 and table1 end up: list1ABC table1ADC 1 Quote Link to post Share on other sites
JohannesT 0 Posted October 1, 2014 Author Report Share Posted October 1, 2014 (edited) Correction Add list to list%listThen put one of those two commands in second box I don't really get it - could You please elaborate? arunner26 - thanks, that's a great way. But unfortunately the list comes from a user input so it's kinda hard to predict what list item needs to be what. Edited October 1, 2014 by JohannesT Quote Link to post Share on other sites
Bot-Factory 602 Posted October 1, 2014 Report Share Posted October 1, 2014 To clariy: 1.You generate a list from user input.2. Now you want to change certain list items. Question:How do you know which one you have to change? Do you know the position or do you have to search for it?Will there be only 1 match or multiple matches? Can you describe the usecase a little bit. The user enters stuff. You create a list. Why do you want to change some entries? And which entries do you want to change? And how do you want to change them? Dan 1 Quote Link to post Share on other sites
JohannesT 0 Posted October 1, 2014 Author Report Share Posted October 1, 2014 To clariy: 1.You generate a list from user input.2. Now you want to change certain list items. Question:How do you know which one you have to change? Do you know the position or do you have to search for it?Will there be only 1 match or multiple matches? Can you describe the usecase a little bit. The user enters stuff. You create a list. Why do you want to change some entries? And which entries do you want to change? And how do you want to change them? Dan 1 & 2 are correct. How do you know which one you have to change? Do you know the position or do you have to search for it? - There are pretty much only 2 things that the user inserts - T & T and Vitals International . If the list item is T & T then it should change to certain URL and if the list item is Vitals International then it should change to another certain URL. Pretty much the user could also write the URL's to the input box, but that's not really nice. Will there be only 1 match or multiple matches? - As I described before there will be only 1 match. Hope that clarifies a little bit. And thanks guys for all the input! Quote Link to post Share on other sites
Bot-Factory 602 Posted October 1, 2014 Report Share Posted October 1, 2014 1 & 2 are correct. How do you know which one you have to change? Do you know the position or do you have to search for it? - There are pretty much only 2 things that the user inserts - T & T and Vitals International . If the list item is T & T then it should change to certain URL and if the list item is Vitals International then it should change to another certain URL. Pretty much the user could also write the URL's to the input box, but that's not really nice. Will there be only 1 match or multiple matches? - As I described before there will be only 1 match. Hope that clarifies a little bit. And thanks guys for all the input! Ok, so that's relatively easy. Build a loop with list total.Use a #counter. increament that counter in every run.Use $list item with #counter to read the current value of that list item.Compare it to what every you want.Then use set list position and write the correct / update values to a new list. If nothing needs to be changed, write the value from list1 to list2. Then you have all the update stuff in list2 and you continue with that. Or you can use a table, then you can change everything in the same spot. No difference really. Hope that makes sense.Dan 1 Quote Link to post Share on other sites
Bot-Factory 602 Posted October 1, 2014 Report Share Posted October 1, 2014 Quick Example: clear list(%test1)clear list(%test2)add list to list(%test1, $list from text("12345", $new line), "Don\'t Delete", "Global")set(#counter, 0, "Global")loop($list total(%test1)) { if($comparison($list item(%test1, #counter), "=", 4)) { then { add item to list(%test2, "4xxxx", "Don\'t Delete", "Global") } else { add item to list(%test2, $list item(%test1, #counter), "Don\'t Delete", "Global") } } increment(#counter)}alert($text from list(%test2, $new line)) 1 Quote Link to post Share on other sites
JohannesT 0 Posted October 5, 2014 Author Report Share Posted October 5, 2014 Quick Example: clear list(%test1)clear list(%test2)add list to list(%test1, $list from text("12345", $new line), "Don\'t Delete", "Global")set(#counter, 0, "Global")loop($list total(%test1)) { if($comparison($list item(%test1, #counter), "=", 4)) { then { add item to list(%test2, "4xxxx", "Don\'t Delete", "Global") } else { add item to list(%test2, $list item(%test1, #counter), "Don\'t Delete", "Global") } } increment(#counter)}alert($text from list(%test2, $new line)) Thanks mate, that worked wonderfully! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.