TACTIC Open Source
Need Help with Expression error - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: Need Help with Expression error (/showthread.php?tid=36)



Need Help with Expression error - rajavinoth - 11-29-2019

Hi,

      I try to get work hour based on row date using below expression :

@GET(sthpw/task.sthpw/work_hour['day', @GET(.timestamp)].straight_time)  

I got error (Expression error: 'datetime.datetime' object is not iterable) . So I try to convert the date into string using  expression {@GET(.timestamp), %Y-%m-%d} .


It is working fine and convert the date time object to date format without any issue. But when I used it in the Expression like below :


@GET(sthpw/task.sthpw/work_hour['day', {@GET(.timestamp), %Y-%m-%d}].straight_time)

I got the error :
 
Expression error: Could not process token [{] search type [sthpw/work_hour['day', {@GET(.timestamp), %Y-%m-%d}]] in expression [@GET(sthpw/task.sthpw/work_hour['day', {@GET(.timestamp), %Y-%m-%d}].straight_time)]

Help me to solve the issue, am using tactic version 4.0. 

Thanks in advance


RE: Need Help with Expression error - listy - 11-29-2019

Closing brackets can be replaced with @EVAL( @GET(.timestamp) )

But a can't understand what do you want to achieve? May be there some easier ways


RE: Need Help with Expression error - Celton McGrath - 11-29-2019

Hi Rajavinoth,

Can you provide a little bit more context? What is your base search type for your table layout? Also, how are the tasks associated to the base search type?

Thanks!

Celton


RE: Need Help with Expression error - rajavinoth - 12-02-2019

Hi,
    Thanks for your replies .

I used the expression on Table widget expression. 
[attachment=12]

I try to get work hours from another table filter by day as timestamp date. 

when i using below expression:

@GET(sthpw/task.sthpw/work_hour['day', @GET(.timestamp)].straight_time)

I got error Expression error: 'datetime.datetime' object is not iterable. If i give date manually like @GET(sthpw/task.sthpw/work_hour['day', '2019-12-02 00:00:00'].straight_time) is working and give exact result.

[attachment=13]


RE: Need Help with Expression error - listy - 12-04-2019

You can try something like this:
"@GET(sthpw/task['timestamp', 'is before', @GET(complex/scenes['code', 'SCENES00004'].timestamp),'%Y-%m-%d'].timestamp)"

This is pretty much returning me list of timestamps.


RE: Need Help with Expression error - rajavinoth - 12-04-2019

Yeah! it's working great thanks @listy Smile