This topic is locked

Condition

1/4/2019 9:28:16 AM
PHPRunner General questions
P
peters19108 author

I have a table with total of 5 fields with one out of the 5 is an Alias field
SELECT

actor_id,

TaskStartTime,

TaskEndTime,

unit,

(TIMEDIFF(TaskEndTime,TaskStartTime)) AS Time

FROM actor
As you can see I am doing a time diff calculation which is working find providing elapse time. The problem I me having is trying to use the result from the calculation and run a condition check against it with an Event Before Record Update with following code.,but unfortunately the below code doesn't work
if ($values["Time"]<= "00:07:00")

$values["Unit"]="0";
else
if ($values["Time"]>= "00:08:00")

$values["Unit"]="1";
so if the minuets is less equal to 7 I would like to place a 0 in the unit Field or if it's Greater equal to 8 place 1 in the Unit field

Please let me know what I am doing wrong. Thanks
I am using Ver 9.6 of PHPRunner

P
peters19108 author 1/6/2019

Anybody!

A
ayctech 1/8/2019

try this.

if (strftime($values["Time"])> "00:07:00")

{

...

}
fhumanes 1/8/2019

Hello:
To detect things of this type, I always use NetBeans PHP, I debug the resulting program using PHPrunner and thus I see the contents of the variables in PHP when they reach a condition or when a value is assigned to it.
I recommend this for all those who wish to develop an application, because they will always need to write code and they will always get something that no matter how many revisions they make, they will not see it.
In your case, I believe that the value of the "time" field is a text type field and the format with which you are comparing is not the correct one.
Regards,

P
peters19108 author 1/11/2019



try this.

if (strftime($values["Time"])> "00:07:00")

{

...

}



This code did not do the trick. Thanks anyway.