Questions and discussion about using ProcessMaker 2: user interface, running cases and functionality
Forum rules: Please search to see if a question has already been asked before posting. Please don't ask the same question in multiple forums.
By as13969
#812993
Hi PM Gurus,

I do have a form that contains multiple fields. One field is a dropdown field that contains the registered courses and using a SQL connection [Report].
If a user select a course name that is listed on the dropdown, it populates the information to the dependent fields (textboxes and drop-down).

I do managed to populate the information to textboxes but for dependent dropdown menu I'm not able to do so.

Could you please assist me on how to populate information to dropdown menu? :roll: Thanks, in advance.

Below is the SQLcode of the puldown menu's

[Pulldown of Course menu]

Field name: WorkshopNameFav

SELECT WorkshopName,WorkshopName FROM PMT_CESUPPORTREQUEST WHERE RequesterName=@@RequesterName AND APP_STATUS NOT LIKE "DRAFT" AND WorkshopName IS NOT NULL ORDER BY app_number DESC

[Pulldown of the dependent dropdown (Yes /No) ]

Field name : WorkshopCost

SELECT WorkshopCost,WorkshopCost FROM PMT_CESUPPORTREQUEST WHERE RequesterName=@@RequesterName AND WorkshopName=@@WorkshopNameFav ORDER BY app_number DESC LIMIT 1
User avatar
By amosbatto
#813007
If I understand your form correctly, then you have created an infinite loop in your dependent queries. Your "WorkshopNameFav" field is referencing your "RequesterName" field and your "RequesterName" field is referencing your "WorkshopNameFav" field. So they will keep referencing each other infinitely and never terminate the query.

Another thing to keep in mind is that dependent fields only work correctly if the ID of the dependent field is the same as the name of its associated variable. So the "RequesterName" field needs to have an ID of "RequesterName" and its associated variable needs to also be "RequesterName". If the ID is different from the variable name, then they won't work correctly.

If those two things aren't the problem, then export the .json file for your dynaform and the data and structure of your table and post them here and I will look at them.
By as13969
#813008
Hi Amosbatto,

Thank you for the reply regarding my issue. I've followed the second item you've mentioned but still not selecting the item in dropdown field.

Attached to this reply is the pmt and data and structure of the table I'm using.

Just to give you an overview of what I'm doing below is the screenshot. The dependent textfields are working but the dropdown menu the result of the query does not select the item in the dropdown field.

CEForm.jpg
screenshot
CEForm.jpg (102.63 KiB) Viewed 4927 times
Attachments
CSV File
(3.79 KiB) Downloaded 317 times
Form Request
(139.85 KiB) Downloaded 299 times
User avatar
By amosbatto
#813024
Oh, I didn't realize when I answered yesterday that you were talking about a Classic process. You can ignore everything I told you about the variable name needing to match the ID of the field, because that only applies to BPMN processes in PM 3.

I don't see the problem. I need to see the field names of your Report Table. Can you export the schema of your Report Table? (It should be a .pmt file.)
By as13969
#813027
No worries. Thanks for the swift reply.

As requested, attached is the schema of the report table.

What I want to do is to select that item on the dropdown field based on the query result I' getting (Yes or No). I'm not sure if this is
applicable for auto-fill dependent dropdown.
Attachments
Report table schema
(15.18 KiB) Downloaded 314 times
User avatar
By amosbatto
#813035
The problem is that dependent fields in dropdown boxes are designed to set the list of options in the dropdown, not set the selected value as you are trying to do in your form.
If you want to select the value in the dropdown with an SQL query, then delete the SQL query from WorkshopCost.

Then add an extra hidden field named "WorkshopCostHid" to your DynaForm which has the same query:
SELECT WorkshopCost,WorkshopCost FROM PMT_CESUPPORTREQUEST WHERE RequesterName=@@RequesterName AND WorkshopName=@@WorkshopNameFav ORDER BY app_number DESC

Then, change the properties of the RequesterName and WorkshopName fields to make WorkshopCostHid their dependent field.

Then you need to add the following JavaScript to your form:
Code: Select all
var previousWorkshopCost = getValueById("WorkshopCostHid");
function checkIfCostChanged() {
   var currentCost = getValueById("WorkshopCostHid");
   if (currentCost != previousWorkshopCost) {
       previousWorkshopCost = currentCost;
       getField("WorkshopCost").value = currentCost;
   }
}
Timer(checkIfCostChanged, 200);
I can't test this (since I can't import your Report Table), but it should be something like that.

Experience heightened pleasure with Cenforce 100 M[…]

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]

Betvisa clone scripts are pre-built software solut[…]