How show different ENUM lists based on variable in input form? | Community
Skip to main content
Level 2
May 26, 2020
Solved

How show different ENUM lists based on variable in input form?

  • May 26, 2020
  • 2 replies
  • 8229 views

How can I decide what enum list to show in a delivery based on a variable I have in the input form?

I don't need anything for creating/changing the enum values or the enum lists themselves. ONLY the path itself that leads to a existing Platform Enumeration list. So the path itself should be the only thing that could be different based on the variable.

Right now I am able to show the enum list (from Enumerations under Platform) and be able to chose between the enums with this:

(I have changed names to make it easier to understand)

In delivery schema:

 

<attribute dbEnum="xtk:enum:one_keyword" label="Keyword" length="100" name="keyword" type="string"/>

 


In delivery Input form:

 

<container colspan="1"> <input label="Keyword" xpath="@one_keyword"/> </container>

 


The enum list is in Platform-->Enumerations and not made in the schema, since I am dependent on not having to change the schema to add/change enum values. (So I am not currently using <enumeration></enumeration> )


But I want to be able to, based on a variable (e.g that's stored in /tmp/ in the input form) or similar, to change the path to the enum list that will be displayed.

So, if the variable I have has the value "one", I want this to be the chosen displayed enum list path:
"xtk:enum:one_keyword"

If the variable's value is "two"
"xtk:enum:two_keyword"

If the variable's value is "three"
"xtk:enum:three_keyword"

 

... and so on.

Kind of like this if that was possible, or something similar:
"xtk:enum:"+enumVar+"_keyword"

Or if I could define the dbEnum directly in the input form instead of in the schema, that would also be nice! Is this possible?

I will have maybe 20 different enum lists, so would be great if there's a way without making 20 attibute copies.

Would really appreciate replies and suggestions!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jyoti_Yadav

Hi,

 

Do you need to do this in input form?

 

If you ultimate aim is to add Platform enumerations based on different variables, you can achieve this via Javascript also.

Design a JS: which will insert values in xtk:enum based on variable passed.

There are two approach possible:

1) Pass list of variable in workflow and perform insert operation in xtk:enum using JS activity.

2) Use SOAP call to your JS function which will perform insert on each variable value.

 

Thanks.

2 replies

Milan_Vucetic
Level 9
May 28, 2020

Hi @helenehh ,

you can use sysFilter.

<sysFilter>
<condition expr="variable_location = value1"/>
</sysFilter>

 Theoretically, it could be done with enabledIf bu you must adjust it properly to your use case.

<enumeration basetype="string" default="A" name="something">
<value enabledIf="variable_location = value1" label="A" name="A" value="A"/>
<value enabledIf="variable_location = value1" label="B" name="B" value="B"/>
<value enabledIf="variable_location = value1" label="C" name="C" value="C"/>
</enumeration>

Regards,

Milan

HeleneHHAuthor
Level 2
May 28, 2020
Thank you so much for your reply! I am not defining the enumerations inside the schema itself though, they only exists in Platform-->Enumerations, so that when adding a new enum in that list, it will automatically show up in the list in the input form, without needing any changes to schema. I will have several different enum lists (in Platform-->Enumerations), and the enum list showing should be based on the user / a variable value. Can I still use sysFilter and enableIf for this?
Jyoti_Yadav
Jyoti_YadavAccepted solution
Level 8
June 3, 2020

Hi,

 

Do you need to do this in input form?

 

If you ultimate aim is to add Platform enumerations based on different variables, you can achieve this via Javascript also.

Design a JS: which will insert values in xtk:enum based on variable passed.

There are two approach possible:

1) Pass list of variable in workflow and perform insert operation in xtk:enum using JS activity.

2) Use SOAP call to your JS function which will perform insert on each variable value.

 

Thanks.

HeleneHHAuthor
Level 2
June 4, 2020

Hi @jyoti_yadav ! Thank you for your reply!

I do not need to do it in the input form, but it would be the easiest 🙂

I will look into what you suggested! But it seems to me that this is for inserting values into the enum list(s)?

I don't need anything for creating/changing the enum values or the enum lists themselves. ONLY the path itself that leads to a existing Platform Enumeration list. So the path itself should be the only thing that could be different based on the variable. If this makes sense to you? 🙂