Page 1 of 1

Display values from database in a dynaform - correct approach to do that?

Posted: Tue Jul 20, 2021 2:50 am
by Michael44
Hello again ;)

I'm still learning a lot while creating my first process in my test system.

Currently I'm asking myself how to display data e.g. a single value (like system or user variables) or a sql output in my dynaform? Is the correct approach to do that using a panel with code to display those things? Or do I overlook something in PM?

Thanks a lot for your help!

Re: Display values from database in a dynaform - correct approach to do that?

Posted: Tue Jul 20, 2021 3:18 am
by kirkwg
Hello Michael,

Normally you can get started with ProcessMaker document. I seldom use Panel unless I have very special things to be displayed. Usually displaying via Dynaforms are quite enough for normal workflow.

To display your data:
At Dynaform - e.g. add a textbox, say id= txt_cityName

Usages:
1/ if a city name will be preloaded into the box during the form loading, I can use a trigger (in PHP) put before dynaform:
create a trigger with a name 'Init Values' > contents > @@txt_cityName = 'Berlin';
Result: when your form loading, the textbox will have 'Berlin' be displayed ...

So have fun to try! Cheers. Read document and follow it to do exercises ....

Re: Display values from database in a dynaform - correct approach to do that?

Posted: Tue Jul 20, 2021 9:57 am
by Michael44
Hello kirkwg,

thanks for your helpful comment. This is what I was searching for.

May I ask another question regarding this: I want to print the result (multiple rows) of a sql query. How would this be done? I would put it in an array and then print it out. But in PM I can't find a solution.
-> I can't print an array in a textbox.
-> Creating a string var with that sql statement writes only first row of the query into it

Re: Display values from database in a dynaform - correct approach to do that?

Posted: Tue Jul 20, 2021 8:56 pm
by kirkwg
Hi,

I can show you some useful links for your information relating to your topic here:
Then you can follow and do the exercises, thanks.

1/ Retrieve data from PM Table and display on Dynaform's Grid control OR vice versa Grid's contents written back to Table
https://wiki.processmaker.com/3.2/PM_Tables#Populating_DynaForm_Grids

2/ Passing DB Queries to a Dropdown & Passing Grids to Dropdowns
https://wiki.processmaker.com/index.php/2.0/Dropdown_Boxes_and_Listboxes#Passing_Database_Queries_To_Dropdowns

Yes you should be excited in above, happy reading!

Re: Display values from database in a dynaform - correct approach to do that?

Posted: Wed Jul 21, 2021 4:37 am
by Michael44
Thanks for your help and the links, kirkwg!