Jump to content
UBot Underground

Any way to use list items in set?


Recommended Posts

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:

 

list1

A

B

C

 

table1

A

D

C

  • Like 1
Link to post
Share on other sites

Correction

 

Add list to list

%list

Then 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 by JohannesT
Link to post
Share on other sites

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

  • Like 1
Link to post
Share on other sites

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! :)

Link to post
Share on other sites

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

  • Like 1
Link to post
Share on other sites

Quick Example:

 

clear list(%test1)
clear list(%test2)
add list to list(%test1$list from text("1
2
3
4
5"$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))

  • Like 1
Link to post
Share on other sites

Quick Example:

 

clear list(%test1)

clear list(%test2)

add list to list(%test1$list from text("1

2

3

4

5"$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! 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...