How to convert code and id in forms bonita?

1
0
-1

Hi,

I need to convert the id and code to name. I save the id and code in my main table instead of the name. But when I display the content of table it shows the id and code. I have tables that handle the equivalent of the code and id. How can i convert it in my UI Designer. Please help. Thanks

Comments

Submitted by Sean McP on Wed, 02/01/2017 - 07:53

What I'd and code? Makes no sense...

Submitted by ChristianMichae... on Wed, 02/01/2017 - 08:31

Hi,

I have a main table petty cash header but the company value I store in bdm is code. But I have a table that holds the lookup value of that code. I want to get the name in the lookup value table.

Submitted by ChristianMichae... on Fri, 02/03/2017 - 04:03

Hi Sean,

Is it possible?

Thanks

Submitted by Dibyajit.Roy on Mon, 02/20/2017 - 08:45

Hi
Did you mean you want to retrieve name of an User based on Id ?

Submitted by ChristianMichae... on Mon, 02/20/2017 - 10:35

Hi Roy,

I have in my table code and name (e.g. 001-All Company). Now in my select list i am displaying the name and store in bdm the code. Now when I display and retrieve values in my bdm I get the code since it is the one I store in bdm since it is the requirement we do. I want to display the name in my setup table for my UI How can I do it?

Submitted by Dibyajit.Roy on Mon, 02/20/2017 - 10:56

Yes. Thanks for the Explanation . Here is what i understood.

Scenario 1 - You have the Information (both 001 - All Company) in a table. Which you display to the User.
But you save only the code in another table . Now you want to bring the name from Table 1 and Code from Table 2 .

Scenario 2 - setup table is the Final Table from which you are displaying the code that you had earlier saved. If you want to display the name as well, could try saving both the values (code and name) as well in the same table.
This way it will be easier for you.

Scenario 3 - in the first table where you mentioned that you have (001 and All company), you only want to Display the name but on selection, only the code gets saved in the background.
Hence user just sees the name and selects one but in the background only the code is saved.

Perhaps you could do a detailed scenario

Submitted by ChristianMichae... on Mon, 02/20/2017 - 11:43

Hi Roy,

Scenario 1 is almost right. I store the code in the main table from the lookup table. And when I want to display the name I will query from the lookup table where I can get the name. How will I do it?

Thanks

1 answer

1
0
-1

Here is how I did it.

1) Inside the Page or Form , create a page variable of type string.Keep the Variable empty . In the Page where you are displaying the code, that you are fetching from the main table. You must be displaying all the Available codes in a drop down .(you could use check box as well)
User has to select a particular value from the available values in the Drop down.

2) collect the selected value and save the value inside the page variable (string) that you had declared earlier.
To do that you need to use the formInput.variableName in the value section for the dropdown.

3) Now Fire an API call to the Lookup table using the page variable value. Bonita provides inbuilt API's to query the database. To get a list of available API to use
go to Bonita Studio => Development =>Business Data Model =>Manage => select the Table
that you want to Query => Navigate to Queries => it will show all available Queries.

Below is the Sample of my Query -

../API/bdm/businessData/com.myModel.qa.model.IRCApproval?q=findByStatus&p=0&c=1000000&f=status={{status}}

As you can see that status is the value that I collect separately and pass it to the API query as a parameter.
The return value is a JSON which you could filter with Javascript or Assign it to another Dropdown and use the displayed key property to show the relevant value.

Regards

Notifications