Working with lists

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Working with lists

L2 Linker

Hi , 

In the settings section i created a new list 

The list contains for example: 

 

TEST,Mon Oct 30 2023,Teva.com/\teva.co.il/\test@gmail.com,user1,
BBLTD,Mon Oct 30 2023,10.0.0.14/\DASD.com/\sdasdas.co.il,user1,
BBMA,Mon Oct 30 2023,10.0.0.14/\DASD.com/\sdasdas.co.il,user2

 

in a playbook a user can choose 1 of the 3 ("TEST"/"BBLTD"/"BBMA")
Then the whole line should be deleted , the command !RemoveFromList only removes the specific word...

1 accepted solution

Accepted Solutions

L2 Linker

@Bar_Magnezi,


The command !RemoveFromList only removes single elements from a comma-separated list. 
To remove the items from the list based on a user selection, you can do it following this simple process:

1. Survey the user with selection ("TEST"/"BBLTD"/"BBMA"). This can be a Data Collection task and it will record the answer in <DC Name>.Answers.0.
2. Load the content of your list into context data, splitting it by line break as delimiter. This can be a Set command with Split&Trim transformer.

3. From the list in context data, select the list item that contains the answer from the survey. For example, if the user selected BBLTD, this task will retrieve "BBLTD,Mon Oct 30 2023,10.0.0.14/\DASD.com/\sdasdas.co.il,user1,". You can do this by using a filter. 
4. Compare this list item with the full list by using the automation CompareLists. This automation takes in two arguments, left and right and it will output the unique elements on each side. From this output, we're only interested in getting all the elements in the list, except the list item that the user selected. 

5. We overwrite the list with the command setList

I've attached here a simple playbook that does this process as a proof of concept. The prerequisite to run this is to have a list called TestLiveCommunityQuestion with this content:


TEST,Mon Oct 30 2023,Teva.com/\teva.co.il/\test@gmail.com,user1,
BBLTD,Mon Oct 30 2023,10.0.0.14/\DASD.com/\sdasdas.co.il,user1,
BBMA,Mon Oct 30 2023,10.0.0.14/\DASD.com/\sdasdas.co.il,user2


To use this playbook, unzip the yml file and upload it to your list of playbooks. 

View solution in original post

1 REPLY 1

L2 Linker

@Bar_Magnezi,


The command !RemoveFromList only removes single elements from a comma-separated list. 
To remove the items from the list based on a user selection, you can do it following this simple process:

1. Survey the user with selection ("TEST"/"BBLTD"/"BBMA"). This can be a Data Collection task and it will record the answer in <DC Name>.Answers.0.
2. Load the content of your list into context data, splitting it by line break as delimiter. This can be a Set command with Split&Trim transformer.

3. From the list in context data, select the list item that contains the answer from the survey. For example, if the user selected BBLTD, this task will retrieve "BBLTD,Mon Oct 30 2023,10.0.0.14/\DASD.com/\sdasdas.co.il,user1,". You can do this by using a filter. 
4. Compare this list item with the full list by using the automation CompareLists. This automation takes in two arguments, left and right and it will output the unique elements on each side. From this output, we're only interested in getting all the elements in the list, except the list item that the user selected. 

5. We overwrite the list with the command setList

I've attached here a simple playbook that does this process as a proof of concept. The prerequisite to run this is to have a list called TestLiveCommunityQuestion with this content:


TEST,Mon Oct 30 2023,Teva.com/\teva.co.il/\test@gmail.com,user1,
BBLTD,Mon Oct 30 2023,10.0.0.14/\DASD.com/\sdasdas.co.il,user1,
BBMA,Mon Oct 30 2023,10.0.0.14/\DASD.com/\sdasdas.co.il,user2


To use this playbook, unzip the yml file and upload it to your list of playbooks. 

  • 1 accepted solution
  • 1085 Views
  • 1 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!