Variable API Rest for popular dropdown with BDM content

1
0
-1

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=sh...

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?

Comments

Submitted by Lionel Palacin on Mon, 06/05/2017 - 16:43

What is the value of $item?

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 16:51

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

1 answer

1
0
-1

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

Comments

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 18:24

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 :)

Submitted by Lionel Palacin on Mon, 06/05/2017 - 18:27

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

For info, I exported it using a Bonita Community 7.5.0

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 18:31

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

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 18:34

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.

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 18:34

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.

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 18:53

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

Submitted by Lionel Palacin on Mon, 06/05/2017 - 19:21

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.

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 19:48

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

Submitted by Lionel Palacin on Mon, 06/05/2017 - 20:02

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

It will add a new Json Object in the collection.

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 20:06

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

Submitted by Lionel Palacin on Mon, 06/05/2017 - 20:09

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.

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 20:10

It adds a new line, however, I can not select anything on the second line:
https://drive.google.com/file/d/0B8aMiLwwVY0nbGNHVmxseTJldG8/view?usp=sh...

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 20:11

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.

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 20:15

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?

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 20:21

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

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 20:44

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?

Submitted by romualdo.s.rs on Mon, 06/05/2017 - 21:12

In case you can take a look like this my UI Designer I will leave the link for you to take a look.

I am a beginner in prettySoft so any tips you can give me to improve I will be very grateful.
https://drive.google.com/file/d/0B8aMiLwwVY0ndFhZMzl3QkFBQmM/view?usp=sh...

Submitted by romualdo.s.rs on Tue, 06/06/2017 - 15:45

Good morning Lionel Palacin,

You know if as in the example that you showed me I can perform a filter in the "Available value" if the variable is API REST

I await your return

Notifications