Expand my Community achievements bar.

Adobe Campaign User Groups are live now. Join our Adobe Campaign User Groups and connect with your local leaders!

Is it possible to use a variable in input xpath (or any xpath) in input form?

Avatar

Level 2

Is it possible to use a variable in an xpath in Input Forms?

 

Something like this? (I know this exact thing won't work, but just to illustrate)

 

 

<!-- Something that would result in the xpath reading e.g. "parameters/keywords/@second_keyword" -->
<input label="Keyword" xpath="'parameters/keywords/@' + [/tmp/@keywordNumber] + '_keyword'"/>

 

 

 


Fore example / More elaborate explanation..:

If I have this in a data schema:

 

 

<srcSchema ...>
    <element label="Parameters" name="parameters">
      <element label="Keywords" name="keywords">
        <attribute dbEnum="xtk:enum:first_keyword" label="First Keyword" length="50" 
                   name="first_keyword" pkgStatus="always" type="string" xml="true"/>
        <attribute dbEnum="xtk:enum:second_keyword" label="Second Keyword" length="50" 
                   name="second_keyword" pkgStatus="always" type="string" xml="true"/>
        <attribute dbEnum="xtk:enum:third_keyword" label="Third Keyword" length="50" 
                   name="third_keyword" pkgStatus="always" type="string" xml="true"/>
      </element>
    </element>
</srcSchem>

 

 

 

And let's say this in an external delivery input form:

 

 

<form ... >
<entry>
    <!-- Variable that can contain "first", "second" or "third" -->
    <set value="second" xpath="/tmp/@keywordNumber"/>
</entry>

    <container ... >
        <!-- Showing currently the enum list (hard coded) called "first_keyword", but I want "first" not to be hard coded -->
        <input label="Keyword" xpath="parameters/keywords/@first_keyword"/>
    </container>

</form>

 

 


Is there a simple ish way of using e.g. /tmp/@keyword in the input xpath instead of "first", "second" or "third" being hard coded?

So I hope there's something like this existing: (Again, I know this below does not work, but hope you get the idea of what I want to achieve)

 

 

<!-- Something that would result in the xpath reading "parameters/keywords/@second_keyword" -->
<input label="Keyword" xpath="'parameters/keywords/@' + [/tmp/@keywordNumber] + '_keyword'"/>

 

 

 

I've also looked into xpath-valuesxpathLinkxpathExpr, xpathEnum, and a few others, but not sure how they work...


Would really appreciate if anyone here knows if this really is doable and how!

2 Replies

Avatar

Level 2

Hi @sushmapandey ! Thank you for responding!

 

Like this?

 

<input label="Keyword" xpath="parameters/keywords/@<[/tmp/@keywordNumber]>_keyword"/>

 

 

No, xpath does not allow '<'. Or maybe you meant something else? I was hoping this would work without js, since I already have the variable in the input form, just need that to be part of the xpath


So I'm looking to either get to use the variable in the xpath, or in enum (path), if that works!:

Like from (hard-coded) :

 

 

<input enum="xtk:enum:first_keyword" label="UsingEnum" type="sysenum"/>

 

 

To (using variable):

 

 

<input enum="xtk:enum:<[/tmp/@keywordNumber]>_keyword" label="UsingEnum" type="sysenum"/>