Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Prepopulate dropdown lists with xml file

Avatar

Former Community Member

Hi everyone,

I'm trying to prepopulate a dropdown list using an xml file. There are many tutorials on the internet that allows me to do that from the preview tab of the designer. However, when I did that it worked well, but i'm not able to "embed" the xml file so that the values will appear in the workspace when the user start a process.

I tried to load the xml file with read resource content in the action profile of the first task, and put the result in the "xmlPrepareData" but the problem is that I can't set any values of the xmlPrepareData after because the xml template isn't exactly the one used by LiveCycle.

Any thought ? Is anyone already succeded in prepopulate a dropdown list with an xml file inside the process ?

Regards,

Thomas

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

ok gr8 ..

Assuming that u are able to get the xml file from LC process to your XDP/PDF form field.

You can resolve the xml file to dropdown list as -

//clear drop-down list box
*DROPDOWN_Field.clearItems();


choiceList = XMLData.parse(*XML_Field.rawValue, false);

//split the choiceList into an array of values

choices = choiceList.resolveNodes("root.element[*].*NODENAME");

var numchoices = choices.length;

//add an array of values to drop down list
for (var i = 0; i < numchoices; i++)

{
*DROPDOWN_Field.addItem(choices.item(i).value);
}

*DROPDOWN_Field -- Is your drop-down field.

*XML_Field -- Is your XML data that is stored in a TextField.

*NODENAME -- Is node name in your XML to be resolved.

Hope it Hepls..

Regards--

Chalukya.

View solution in original post

6 Replies

Avatar

Former Community Member

Hi,

you make invoke a shortlived process[which populates your dropdown values, example: Query for Multiple Rows as XML service] when the user start a process from workspace and prepopulate a dropdown list using that xml file.

Regards --

Chalukya.

Avatar

Former Community Member

Hi,

First of all, thanks for your response !

I already have an xml file that I use to preview the form in LiveCycle designer.

How exactly do I "prepopulate a dropdown list using that xml file" in a process ?

Thanks

Avatar

Former Community Member

is my understanding correct ..

you want to prepopulate a dropdown list using xml file in XDP/PDF form, when a user initiates a process from workspace..

Avatar

Former Community Member

Yes, you're right.

I have dropdown list which should contain like hundreds of values, so i want those values to be stored in an xml file, simply maintainable.

So I want to add the values in the dropdown list when the users initiates a process from the workspace, exactly

Avatar

Correct answer by
Former Community Member

ok gr8 ..

Assuming that u are able to get the xml file from LC process to your XDP/PDF form field.

You can resolve the xml file to dropdown list as -

//clear drop-down list box
*DROPDOWN_Field.clearItems();


choiceList = XMLData.parse(*XML_Field.rawValue, false);

//split the choiceList into an array of values

choices = choiceList.resolveNodes("root.element[*].*NODENAME");

var numchoices = choices.length;

//add an array of values to drop down list
for (var i = 0; i < numchoices; i++)

{
*DROPDOWN_Field.addItem(choices.item(i).value);
}

*DROPDOWN_Field -- Is your drop-down field.

*XML_Field -- Is your XML data that is stored in a TextField.

*NODENAME -- Is node name in your XML to be resolved.

Hope it Hepls..

Regards--

Chalukya.

Avatar

Former Community Member

Thanks a lot chalukya !

This is not the way I wanted to do this at the beginning, but it works fine !

Thanks again

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----