Calling a script in Entity Display Format?

:scream:

No dont just type Luis

type clockIn(‘Luis’) and press Test

LOL please copy this exactly and put it in there.

clockIn(‘Luis’)

We are playing internet tag lol

1 Like

:rofl: I’m sorry I just caught that

You need to edit the SQL part. The variable needs to be = “+name+” NOT =“name”

1 Like

So first you need to get it to return a value. THen try it in the field.

1 Like

I know it works though…

Ok I made the query into one line, but now I get a different error:

It could be Substring I am not sure.

1 Like

You cant spread a sting over lines like that as you realised.

Also from memory I dont think you can just return the value of an swl exc, like that as think its always an object or similar.
I had first on all mine I think even queries returning only one row.

1 Like

change r = sql.Query(qry) to r = sql.Query(qry).First;

You can also have a multiline query but you must concatenate fully terminated strings:

var q = "SELECT * FROM SomeTable " +
"WHERE X = Y " +
"AND A > B " +
"ORDER BY Z";
5 Likes

Having the ‘name’ variable doesn’t work.

But when I hardcode in ‘Luis’, it works…
:sob:


What am I doing wrong :sob:

You need to have ’ ’ within the code before and after the var name.

so that row should be

“and e.[Name] = '” + name + "’ " +

(the
‘" and "’
before/after name is hard to tell but it is
’ " and " ’
but you can’t have spaces in between the quotes or it’ll mess up the code)

2 Likes

This worked! Thank you Jesse, JTRTech, Memo, and BCEats!

Just one more question, how do I make it so that it only calls the script ONLY for clocked-in employees (orange-box)? (eg. ENTITY STATE:TCStatus $1 === ‘PunchIn’)

2 Likes

$1<br/>[= '{ENTITY STATE:TCStatus}' === 'PunchIn' ? {CALL:clockInTimeNew.clockIn('$1') : ''}] doesn’t seem to work…

Nevermind! I just found this!

1 Like

It won’t know what entity your looking at, would need to specify entity with the $1 in a report type expression.

Well, it already seems to know which Entity to pull up :grinning:

1 Like