Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#825313
Hello,
I'm exeperiencing and issue when loading a Form with a SQL statement from PM database. In this form I have a grid with a DropDown loaded with the departments:
[SELECT CON_ID, CON_VALUE FROM CONTENT WHERE CON_CATEGORY='DEPO_TITLE'
AND CON_LANG = @@SYS_LANG
AND CON_ID NOT IN ("7405700685b864cf8efba20081648989", "4685363765b864e003c7ef4099718443", "1815795895b864e13a30438030841764", "8353271485b8651f410efe5000584241")
ORDER BY CON_VALUE]
and another dependent DropDown with the equipment on the selected department.
When I want to access this "entity", I have a trigger with a SQL to select the values, including the Department:
Code: Select all
$var = @@SerialNumber;
$var1 = @@CustomerID;
$result = executeQuery( "SELECT * FROM PMT_CUSTOMER_MI WHERE SERIALNUMBER = '$var' AND APP_STATUS = 'COMPLETED' AND 
    CUSTOMERID = '$var1' ORDER BY APP_NUMBER DESC LIMIT 1");
if (is_array($result) and count($result) > 0) {
    @@CalibrationLast = $result[1]['CALIBRATIONLAST'];
    @@CalibrationNext  = $result[1]['CALIBRATIONNEXT'];
    @@CalibrationProcedure  = $result[1]['CALIBRATIONPROCEDURE'];
	@@RecalibrationInterval  = $result[1]['RECALIBRATIONINTERVAL'];
	@%Category  = $result[1]['CATEGORY'];
	@@Manufacturer  = $result[1]['MANUFACTURER'];
	@@MeasuringQty  = $result[1]['MEASURINGQTY'];
	@@Name  = $result[1]['NAME'];
	@@RangeInterval  = $result[1]['RANGEINTERVAL'];
	@@Remark  = $result[1]['REMARK'];
	@@SoftwareIncluded  = $result[1]['SOFTWAREINCLUDED'];
	@@Status  = $result[1]['STATUS'];
	@@Validity  = $result[1]['VALIDITY'];
	@@YearProduction  = $result[1]['YEARPRODUCTION'];
	@@YearStart  = $result[1]['YEARSTART'];
	@@TypeApprovalNumber  = $result[1]['TYPEAPPROVALNUMBER'];
	@@DateCreated  = $result[1]['DATECREATED'];
	@@Accessories  = $result[1]['ACCESSORIES'];
	@=Documentation  = $result[1]['DOCUMENTATION'];
	@@AccuracyClass  = $result[1]['ACCURACYCLASS'];
	@@MiID  = $result[1]['MIID'];
	@@Model  = $result[1]['MODEL'];
	@@OldAppNumber  = $result[1]['APP_UID'];
}
//lOAD GRID OF REFERENCE STANDARDS
$miid = @@MiID;
//This query loads the DropDown with pre-saved values
$query = "SELECT DIVISIONID AS DivisionID, REFSTD as RefStd, CUSTOMERMIID AS CustomerMiID 
   FROM PMT_CUSTOMER_MI_REFSTD WHERE CUSTOMERMIID='$miid'";

$result = executeQuery($query);
if (is_array($result) and count($result) > 0)
    @=gridRefStd = $result;
But the form renders with this image:

(The first grid row is how should be - become like that after I click over the dropdownw!!) The both rows appear like the second.
Any tip about what is happening?
Thanks.
Attachments
issue.PNG
issue.PNG (12.71 KiB) Viewed 1437 times
#825375
Hi Amos,
Thanks again.
Selecting the Departments with your code worked fine (I was suspecting that the issue was with having the filer by LANG).
But I still have the issue sincronizing the dependent column (see picture).

In this process I have 1 Task with 2 forms. On first form the user selects the Customer and the Serial Number of the equipment. If ht Serial Number existe, it opens the form with with its data; otherwise it opens empty for creating a new record. This situation is when the equipment already exists at database. I'm firing up the trigger on "After Dynaform" of 1st form. The equipment data is shown on 2nd dynaform.
Thanks.
Attachments
issue2.PNG
issue2.PNG (7.78 KiB) Viewed 1400 times
#825392
The column id is: RefStd
I'm populating the 'Name' column with this SQL:
SELECT CODE, CONCAT(SERIALNUMBER, ' | ', NAME) AS NAME FROM PMT_GEOSTM_MI
WHERE APP_STATUS = 'COMPLETED'
AND STATUS = 1
AND DIVISION = @@DivisionID

DivisionID is the id of the 1st column (DEP_UID).
#825419
The queries work fine.
I'm suspecting that it is because the first column ID is a CHAR (DEP_UID) and the dependent column cannot syncronize for CHAR field!!!
When I'm doing "AND DIVISION = @@DivisionID", this doesn't work as expected - it shows the 2nd column ID but not the Description (NAME).
I'm just guessing...
Thanks.
Cannot upload CSV

Hi, I am using a multi-file upload. When I upload[…]

A Beginner's Guide for ProcessMaker

I recently completed a book on ProcessMaker - &q[…]

Hi guys. I am a newbie. I don't know how to upgrad[…]

HI Thanks so much! This is just what I need.