Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

User interface for select tool

Namshad
7 - Meteor

Hi All,

 

I am trying to give an interface for select tool, Please find the attached workflow.

 

Namshad_0-1591799285764.png

 

Here I am selecting the required columns using list box, users can select which specific columns they require to be outputted and it is working. But how can I deselect some specific columns using a user interface, that is all columns should be outputted except those are selected by the user.

4 REPLIES 4
Thableaus
17 - Castor
17 - Castor

Hi @Namshad 

 

Here's an approach:

 

Thableaus_0-1591803075015.png

 

 

Thableaus_1-1591803100116.png

 

- You need to change the Select Tool Mode to Generate a Custom List - watch out you need to leave "Start" and "End" in blank and "Separator" as a single comma (,).

- Then, for the action Tool, you need to update the Raw XML with a formula:

 

' <SelectFields>
<SelectField field="' + replace(EscapeXMLMetacharacters([#1]), ",", '" selected="False" />
<SelectField field="') + '" selected="False" />
<SelectField field="*Unknown" selected="True" />
</SelectFields>'

 

This is a tough Formula to understand at first. But the main part of the formula resides here:

replace(EscapeXMLMetacharacters([#1]), ",", '" selected="False" />
<SelectField field="')

 

Basically, imagine that the list of fields to be deselected will come like this if the user selects the first 4 of them in the List Box interface.

Emp_ID, Emp_Name, Age, salary

 

This part of the formula is replacing the comma (,) between each field by this expression

" selected="False" />
<SelectField field="

 

It's basically closing out the expression that deselects a Field (changes it to False) and then starts the following after that.

 

It's a little bit hard to understand, but it works fine.

 

See attached.

 

Cheers,

 

 

Namshad
7 - Meteor

Thank you! This solution worked well.

Namshad
7 - Meteor

Hi

 

Thank for the solution!

 

In the workflow you shared if we select all columns then there will be some error in select tool as there is no column is remaining deselected and to be outputted from that select tool. This issue will be solved if we pass a dummy column before that select tool as I did in the workflow attached. 

I need another branch which outputs the selected columns also , for this I have changed your work flow ( Please find the attached workflow ) in which one branch outputs selected columns and next branch outputs the remaining columns which are not selected.
Case 1 ( working fine 😞  -- If we select all columns then I get only that dummy column  outputted in "deselected data.yxdb".  No error occurs in this case.
Case 2 ( I am facing an issue ) :  if we don't select any column then I am getting an error in the branch for columns which are selected. Actually in this case I need to avoid this error by outputting the dummy column through that select tool into "selected data.yxdb"

 

Friends , please share me if any fix to solve this issue.

ckelley0
8 - Asteroid

let's say you wanted to use the list box to update a select tool and a formula tool.  could you leave the quotation marks in the separator to satisfy the formula tool, then in the action tool connected to the select tool, where the action tool is configured to update raw xml, you could surround the double quotations with single?

Labels