Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
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.
By blackbird
#789428
I have a PM Table name CXO_VISIT_DATE (Fields: CXONAME, STARTDATE, ENDDATE, LOCATION, COMMENT).

Sample Data:
data.PNG
data.PNG (5.86 KiB) Viewed 4915 times
Now I want to get STARTDATE from CXO_VISIT_DATE and want to store in a DateTime (Name: D1) variable. I have a field in Dynaform where I want to show that DateTime by D1.

My Attempt:
@@currentUser_1 --> String
CXONAME --> Varchar
Code: Select all
$uid= @@USER_LOGGED;
@@currentUser_1 = @@USER_LOGGED;

$result = executeQuery("SELECT STARTDATE FROM PMT_CXO_VISIT_DATE WHERE CXONAME = @@currentUser_1"); 
@=DateTimeFromPMTable = $result;

User avatar
By amosbatto
#789470
You can't insert case variables inside double quoted strings like normal PHP variables. Instead, you have to first assign the case variable to a a normal variable and then do the insert. Also user IDs are strings, so they have to be placed inside single quotation marks in your SQL query.
Try this:
Code: Select all
$userId= @@USER_LOGGED;
$result = executeQuery("SELECT STARTDATE FROM PMT_CXO_VISIT_DATE WHERE CXONAME = '$userId' ");
if (count($result) > 0) {
   @=DateTimeFromPMTable = $result[1]['STARTDATE'];
}
By blackbird
#789483
I want to count the day from given time to CurrentTime.
How can I do that?

My try:
Code: Select all
$userId= @@USER_LOGGED;
$result = executeQuery("SELECT STARTDATE FROM PMT_CXO_VISIT_DATE WHERE CXONAME = '$userId' ");
if (count($result) > 0) 
{
   $now = getCurrentDate();
   @%reminderVar = $result[1]['STARTDATE'] - '$now';
}
By mishika
#789484
Hello,

You can achieve the following by making some changes in your trigger code
blackbird wrote: @%reminderVar = $result[1]['STARTDATE'] - '$now';
Replace the above line of code with the following:
Code: Select all
$days = strtotime($result[1]['STARTDATE']) - strtotime($now);
@=reminderVar = $days / (60 * 60 * 24);
Hope this helps

Best Regards,
Mishika

Winzo is a popular and unique game on the mobile p[…]

Cannot create process using templets

Real details. The problem was solved by effect!

However, it is essential to use it responsibly and[…]

Web3 development encompasses creating decentralize[…]