How to display BDM in table

1
0
-1

I need to display the records that are in my BDM in UI Designer, so far I have only been able to display what is in my process variable, through the following code:
../API/bpm/caseVariable/{{task.caseId}}/listaTransportadoras

However I need to display my BDM records in a table in the UI Designer, how can I do this?

I tried to create an API like this:

../{{context.transportadoras_ref.link}}

And I called the attributes of my BDM like this:

retorno.status

But the return was empty, what do I need to change to return have the attribute value of my BDM?

Comments

Submitted by Dibyajit.Roy on Thu, 02/09/2017 - 10:52

Hi

You have the Correct Procedure. Maybe you got the naming incorrect .

Inside your Form, Add a text Field. Replace all the text with {{context}} .
Preview the Page. It should Pull up the correct Ref link.

this is How i check most of Issues .
Hope this helps .

Submitted by romualdo.s.rs on Thu, 02/09/2017 - 11:46

Thanks for trying to help me, I did what you indicated but the Text field returned blank by placing {{context}},
So when putting in an input field it returned me this: "{{properties.placeholder | uiTranslate}}"
Just to confirm, it's literally {{context}} in a text field, or the name of my variable that's receiving my REST API

Submitted by Sean McP on Fri, 03/31/2017 - 04:10

@romualdo.s.rs

the Text field returned blank by placing {{context}}

This is expected, because Context only references Business Data, not process variables. It's really annoying.

So if you are getting nothing are you sure you've added the BDM to the Data? If not then it will show nothing, if you have then is there any data in it?

Add a new External API variable to the page and give is

../API/bdm/businessData/com.company.model.Customer?q=find&p=0&c=100

where com.company.model.Customer is your BDM. You MUST have the q, c and p parameters.

Add a new table to the page

In Content click the button so it shows a white X on dark blue (expression or variable) and type the name of your variable above.

in COLUMN KEYS - you MUST specify the columns you want in the table to show. Note this must be left as fx

That's it should work now...

Note as follows:

{{properties.placeholder | uiTranslate}} comes back when it cannot parse the value and therefore cannot display anything.

It really is {{ context }} in the text field, though we actually put text is to describe it to help us know what it is...

Context: {{ context }}

for example.

regards
Seán

3 answers

1
0
-1

Hi

Sorry I was Not able to Open the BOS file as I am using a Lower Version of Bonita.

I have the BOS file. I will test it out later.

For Now , I have Uploaded screenshot of My Pages where I use the context.ref to Pull Data and Display inside the Page.

Let Me know If you are able to access the Screenshots and iF it Helps you in any way.

Alternately I can open your BOS file once I download a Higher version of Bonita .
Here Is the Link
https://goo.gl/photos/qdCmhGr3SkzQZFgg6

If you want to Display the BDM records inside an Application page(Outside the Portal) .Then you will need a Separate API
/bonita/API/bdm/businessData/com.model.Table_name?q=find&p=0&c=10000

Comments

Submitted by romualdo.s.rs on Thu, 02/09/2017 - 12:18

I looked your images, and apparently their settings are the same as the way I set it, I believe that when you can take a look at my .BOS file, you will understand why I am not understanding what is happening to not display the information of the attributes

Submitted by Dibyajit.Roy on Thu, 02/09/2017 - 12:21

OK.
In that Case , I will have a look later Today. I can Reply Tomorrow.
I have a Question.
This page where you want to Display the Attributes.
1) Is it inside a Portal Task ( Portal Form) .
2) Is it a Separate Application Page . Outside the portal .

Submitted by romualdo.s.rs on Thu, 02/09/2017 - 12:42

Answering your question, I believe it is within a task that has this Form (I am new to Bonitasoft and do not know the correct nomenclature). Another thing I checked for an APi External variable as you suggested in the answer, I am sending the link of the image to you to see the result
https://drive.google.com/file/d/0B8aMiLwwVY0nbFBTSE5sUVRMQTA/view?usp=sh...

https://drive.google.com/file/d/0B8aMiLwwVY0nVDNhTk1nalFIeW8/view?usp=sh...

Submitted by romualdo.s.rs on Thu, 02/09/2017 - 13:16

Reseted my BDM and add a new item that arrest had added:
https://drive.google.com/file/d/0B8aMiLwwVY0ncG10QWFES2t1V1k/view?usp=sh...

But I can not determine that he brings me the name of the carrier, for example

Submitted by Dibyajit.Roy on Thu, 02/09/2017 - 13:23

Hi

From the Screenshot , I dont see the the task Id variable.
You should have a task id Variable Defined .

task Id = ../API/bpm/userTask/{{taskId}}

Submitted by romualdo.s.rs on Thu, 02/09/2017 - 13:29

I added the variable, after that I need to change something else, because the result of the table was the same.
https://drive.google.com/file/d/0B8aMiLwwVY0nOEZHQnhCNGl5WEU/view?usp=sh...

Submitted by Dibyajit.Roy on Fri, 02/10/2017 - 15:01

Hi

I took a look into the BOS file.

I realised that If you using a table then context_ref.link will not work here.
Rather you have to define the Actual link it self.

Here is the Link that worked for me.
../API/bdm/businessData/com.hss.model.Transportadora?q=find&c=100000&p=0

I have made small adjustments to the BOS file. Do check it out
https://drive.google.com/file/d/0B-MHHSlP6-kMZUVHb3NoeGk4QjA/view?usp=sh...

Submitted by romualdo.s.rs on Fri, 02/17/2017 - 17:52

Thanks for the feedback,

I tried to open the .BOS file that you edited, but it is in a version higher than mine (You sent it in 7.4.2 and I have version 7.3.3 installed)

Submitted by Dibyajit.Roy on Fri, 02/17/2017 - 17:58

Hi
I will try to create a sample in 7.3.3 tomorrow and upload .

Did you try with the ../API/bdm/businessData/com.hss.model.Transportadora?q=find&c=100000&p=0
It worked for me.

Submitted by romualdo.s.rs on Mon, 02/20/2017 - 12:30

Good morning, thanks for the feedback. I've made some progress in my work and I'm already able to display the BDM table information in the UI Designer, but I do not want to have repeated information inserted into my BDM, can you help me? I am sending the link to the updated .BOS file

Many thanks for the help.

Link:
https://drive.google.com/file/d/0B8aMiLwwVY0nVXhPemhsQzh0MDA/view?usp=sh...

Submitted by Dibyajit.Roy on Mon, 02/20/2017 - 14:34

Hi
I saw your other post on the same topic.
I assume your are using API to fetch Data from your database.

Hence there should be two separate API returning data from BDM and the other database, variable1 and variable2 for example.
Now, I suggest create a page variable of type javascript.
You could refer to the database records by using the $data.variable1 and $data.variable2 .
Using a loop, you could compare the values.
In case of a unique value, add it to an array. (declare a new array type inside the script)
At the end of the loop, return the Array.
or you could use something like
bdm.setAttribte() = arrayValue

Regards

Submitted by romualdo.s.rs on Mon, 02/20/2017 - 14:45

I put the link to my .BOS file updated in my last comment, would you be able to take a look at how it is now? I created another question here in the forum that explains better how my process is at the moment

Link to the question:
http://community.bonitasoft.com/questions-and-answers/how-compare-two-bu...

I am a beginner in Bonitasoft, if you could analyze my new file would be great. If possible give a more detailed example of how to generate this page variable that you commented would be very good too

Thank you very much for your attention and patience so far.

Submitted by Dibyajit.Roy on Mon, 02/20/2017 - 14:49

Hi
I use the version 7.3.1 at work hence I am not able to open your BOS file.
I could take a look only after i go back home. Hence it will take some time.

Did you see my above comment. Could try that and see if it helps.

Submitted by romualdo.s.rs on Mon, 02/20/2017 - 14:56

Yes I saw the previous comment, but as I said I am new in BonitaSoft and I do not have much knowledge in javascript, so I even suggested that you should see this as my file so that you could edit what I think necessary

Submitted by romualdo.s.rs on Mon, 02/20/2017 - 18:19

I made a script that checks if the information being selected in PostgreSQL is the same as that already in the BDM, but is the reference of the records of my BDM for me in my Log file is appearing and not the information that is what I really need Compare, could you help me with this script?

Log File:

2017-02-20 11:59:43.479 -0300 INFORMAÇÕES: org.bonitasoft Registros BDM: 4
2017-02-20 11:59:43.481 -0300 INFORMAÇÕES: org.bonitasoft Registros Banco de Dados PostgreSQL: 3
2017-02-20 11:59:43.487 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO BDM: com.hss.model.TransportadoraPostgreSQL@1c2fa22
2017-02-20 11:59:43.487 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO POSTGRESQL: com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.487 -0300 INFORMAÇÕES: org.bonitasoft DIFERENTES
2017-02-20 11:59:43.487 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@1c2fa22
2017-02-20 11:59:43.487 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.492 -0300 INFORMAÇÕES: org.bonitasoft
2017-02-20 11:59:43.492 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO BDM: com.hss.model.TransportadoraPostgreSQL@1c2fa22
2017-02-20 11:59:43.492 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO POSTGRESQL: com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.492 -0300 INFORMAÇÕES: org.bonitasoft DIFERENTES
2017-02-20 11:59:43.492 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@1c2fa22
2017-02-20 11:59:43.492 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.492 -0300 INFORMAÇÕES: org.bonitasoft
2017-02-20 11:59:43.493 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO BDM: com.hss.model.TransportadoraPostgreSQL@1c2fa22
2017-02-20 11:59:43.493 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO POSTGRESQL: com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.493 -0300 INFORMAÇÕES: org.bonitasoft DIFERENTES
2017-02-20 11:59:43.493 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@1c2fa22
2017-02-20 11:59:43.493 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.493 -0300 INFORMAÇÕES: org.bonitasoft
2017-02-20 11:59:43.493 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO BDM: com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.493 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO POSTGRESQL: com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.493 -0300 INFORMAÇÕES: org.bonitasoft IGUAIS
2017-02-20 11:59:43.493 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.493 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.493 -0300 INFORMAÇÕES: org.bonitasoft
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO BDM: com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO POSTGRESQL: com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft DIFERENTES
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO BDM: com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO POSTGRESQL: com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft DIFERENTES
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO BDM: com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO POSTGRESQL: com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft DIFERENTES
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft
2017-02-20 11:59:43.494 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO BDM: com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO POSTGRESQL: com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft IGUAIS
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO BDM: com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO POSTGRESQL: com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft DIFERENTES
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO BDM: com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO POSTGRESQL: com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft DIFERENTES
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@5bd5369
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO BDM: com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.495 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO POSTGRESQL: com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.496 -0300 INFORMAÇÕES: org.bonitasoft DIFERENTES
2017-02-20 11:59:43.496 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.496 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@d7e68ae8
2017-02-20 11:59:43.496 -0300 INFORMAÇÕES: org.bonitasoft
2017-02-20 11:59:43.496 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO BDM: com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.496 -0300 INFORMAÇÕES: org.bonitasoft POSSICAO POSTGRESQL: com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.496 -0300 INFORMAÇÕES: org.bonitasoft IGUAIS
2017-02-20 11:59:43.496 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.496 -0300 INFORMAÇÕES: org.bonitasoft com.hss.model.TransportadoraPostgreSQL@12d614f6
2017-02-20 11:59:43.496 -0300 INFORMAÇÕES: org.bonitasoft

Script Groovy:
`
import java.util.logging.Logger;
Logger logger= Logger.getLogger("org.bonitasoft");

def i = 0;
def x = 0;
def z = transportadorasBanco.size();
def y = listaTransportadoras.size();
logger.info("Registros BDM: "+ z)
logger.info("Registros Banco de Dados PostgreSQL: "+ y)

while (x <= (z - 1)){
while (i <= (y - 1)){
if (transportadorasBanco.get(x).toString().equals(listaTransportadoras.get(i).toString())){
logger.info("POSSICAO BDM: " +x)
logger.info("POSSICAO POSTGRESQL: " +i)
logger.info("IGUAIS")
logger.info(transportadorasBanco.get(x).toString())
logger.info(listaTransportadoras.get(i).toString())
logger.info("")
}
else {
logger.info("POSSICAO BDM: " +x)
logger.info("POSSICAO POSTGRESQL: " +i)
logger.info("DIFERENTES")
logger.info(transportadorasBanco.get(x).toString())
logger.info(listaTransportadoras.get(i).toString())
logger.info("")
}
i++;
}
x++;
i = 0;
}`

I know that comparing the references of these records will not advance me because whenever the process starts the references both the pull of PostgreSQL and what I just added in BDM will be the same, so I need to be able to compare the code of the carrier for example.

If you can help me with that, I thank you very much.

regards

Romualdo Santos

Submitted by Dibyajit.Roy on Mon, 02/20/2017 - 19:33

Hi
Its late here. I am not able to go through the .BOS file that you uploaded.
I have not worked with different databases . I mostly use same database but different tables.
I am sure you can figure out a way to fetch data from PostgreSQL into your form/Page.
If you can do that then you might just compare the values from 2 different records .
I believe that all API rest calls retrieve JSON data.
You seem to fetch the data from PostgreSQL inside a pool variable.
There was a tutorial on how to display records from Pool variables inside a designer page.
I believe it was something like myVariable.value(). ( Pls double check on that).
Well here is a sample script that I had used to compare 2 different sets of JSON records.

if ($data.result && $data.result.length)
{
var arr = [];

var j=0;

for (var i = 0; i < $data.result.length; i++) 
{
    var projCat = $data.result[i];

    if(projCat.projectCategory == $data.formInput.category &&  projCat.wbsType == $data.formInput.wbsType1)
    {
        arr[j++] = projCat.investArea;
    }

    //var uniqueSet = new Set(arr); // {"a", "b"}
    //var uniqueArr = Array.from(uniqueSet); // ["a", "b"]
}

var uniqueSet = new Set(arr); // {"a", "b"}
var uniqueArr = Array.from(uniqueSet); // ["a", "b"]

return uniqueArr;

}

Submitted by Sean McP on Mon, 02/20/2017 - 22:24

for all:

A Tip on displaying CODE/LOGS correctly in Posts:

Do not use the Supplied Buttons above, for some reason they refuse to work correctly, and despite bringing it to Bonitasofts attention, it's low priority.

To Show Code/Logs correctly use

< code >
your code/log
< /code >

removing the spaces to allow the showing of code/logs correctly as here:

your code/log

Thanks and regards
Seán

Submitted by Dibyajit.Roy on Tue, 02/21/2017 - 08:31

Hi
I went through your .BOS file. I think you have done a great job. It was working fine for me.
I have made a small minor adjustments
1) In the automatic task - Conexão . Keep the connector to postgreSQL but I have to remove all the Operations . The Task was failing because of the Operations.
2) In the Manual task, I get to see the values from the BDM table - TransportadoraPostgreSQL inside a UI designer table. Here I added a new variable inside the page.
processVariableData - ../API/bpm/caseVariable/{{task.caseId}}/listaTransportadora
this brings the value of the Pool variable.
Inside the page, you could add a text field => make it empty and add {{ processVariableData }} to see the value inside the form (when you run the process).
I found the structure of the processVariableData is different than the BDM API.
Hence we might need o write a special Javascript to compare the values.
If you need, I could share the BOS file

1
0
-1

Hi

Sorry I was Not able to Open the BOS file as I am using a Lower Version of Bonita.

I have the BOS file. I will test it out later.

For Now , I have Uploaded screenshot of My Pages where I use the context.ref to Pull Data and Display inside the Page.

Let Me know If you are able to access the Screenshots and iF it Helps you in any way.

Alternately I can open your BOS file once I download a Higher version of Bonita .

1
0
-1

Have you read the Getting Started Tutorial? All the information you need is in there...
http://documentation.bonitasoft.com/?page=getting-started-tutorial

regards
Seán

PS: While you may not like the answer, it gives a possible solution, please mark as resolved.

Comments

Submitted by romualdo.s.rs on Thu, 02/09/2017 - 11:23

I read the tutorial but did not understand how I can get the contents of my BDM attributes and display in a table in the UI Designer, could you give me an example of how I can do this? I will add the link to my .BOS file from my process, if you can see what I can do to accomplish this task I thank you very much
https://drive.google.com/file/d/0B8aMiLwwVY0nUFl1MUdQYkFaRkk/view?usp=sh...

Notifications