Variable API Rest for popular dropdown with BDM content

Following the example Expense Reports that is made available in the BonitaSoft Site I was able to create a kind of page to select items that come from the bank to create a request with that however I am not able to access the content of what was selected in the first dropdown for then popular the second Dropdown.

https://drive.google.com/file/d/0B8aMiLwwVY0nUXM5LWEwMmFvckE/view?usp=sharing

As I’m getting data that is in my BDM’s, I’m using REST API variables to select the BDM content according to querys created to access their data.But when I use the query:

…/API/bdm/businessData/com.company.model.ModeloImpressoraSuprimento?q=findByCodigoModeloImpressora&p=0&c=10000&f=codigoModeloImpressora={{$item.modeloImpressora.codigoImpressora}}

This query is not populating the second dropdown, how could it do that then?

Hi,

I see, it’s a tricky case. The $item variable used in a multiple container is not available on the form level. The scope is local to the container.

At this point, the only way to do this that I see is to gather all the data to populate the different dropdown at the form loading using REST Apis. Then to put this data in arrays so you can use them in the dropdown.

Here is an example that illustrate that: https://www.dropbox.com/s/vwpsgjvwow2biac/page-TestMultiList.zip?dl=0

Hope this helps.

Cheers

What is the value of $item?

This $item has a specific value in each Collection it is populated according to the first selected dropdown, however I can not use it in a REST API since the value in a REST API can not be changed

Thanks for the help Lionel, I imported your example to my UI Designer but gave the following error:

**Import error

Invalid page.json json file structure

The artifact has not been imported.
Check that the json file structure matches a standard UI Designer export.**

You know how I can handle this?

Thank you very much for your attention :slight_smile:

That’s weird. Do you import it directly in the UI Designer?

For info, I exported it using a Bonita Community 7.5.0

So it might be due to the version, I’m using 7.3.3, I’ll try to download the newer version and see if I can open it then

Let me ask you one thing, can you put different data on the second line if you want to add one more item?

I’m Brazilian, sorry if English is not correct.

Let me ask you one thing, can you put different data on the second line if you want to add one more item?

I’m Brazilian, sorry if English is not correct.

I opened the file that you sent me however it works only in one line, and another thing, the dropdowns really need to be filled with the BDM content creating JSON with the content would not be possible

Oops yeah there was a small mistake on the Add button. Try to change the value add to the Collection from a String to an expression and that should work.

You mean in “Value to add”? If yes, what kind of expression should I put?

Yes in Value to add. You have to enter the expression {}

It will add a new Json Object in the collection.

Already this is the example you sent, in Value to add this “{}”

Yes, that what I meant by “small mistake”. You need to change the type of the field from String to Expression. For that, just click on the Fx icon to switch the field type.

It adds a new line, however, I can not select anything on the second line:

https://drive.google.com/file/d/0B8aMiLwwVY0nbGNHVmxseTJldG8/view?usp=sharing

Would not you have a skype account that we could talk more straightforwardly? So I can show you my project as it is now too.

Now gave your example right :). Do you know if I can apply your example when the data comes from BDM? So how did you use JSON already filled in?

Can I use that same filter you used to populate the second dropdown?

Because from what I understand, in your UI Designer you are applying a filter in the second dropdown so that it only brings information according to what was selected in the first dropdown, can I use that filter that you used when I am bringing the Information from the BDM? What if I export my page to see how I did it? Do you think we could try to do that?