Calling a script in Entity Display Format?

Is it possible to call a script in a Display Format field? I want to make my Clock-in screen show the time a staff clocked-in at.
So far, it just shows the name of the Entity, which is denoted by the $1 before the linebreak.

Pretty sure script works but not sure about your @@

It’s a SQL script, so wouldn’t I need the @@?

Don’t know, I’ve always used full scripts myself.

The @@ is for calling sql scripts in reports.

I tried removing the @@ and it still doesn’t work.

Script:

I dont think it will work in that field. I am pretty sure that field will not support evaluating tags like that.

Try this though {CALL:@@clockintime} instead of {CALL:@@clockintime,$1)

What was the ,$1 for? That is not valid syntax

Maybe try REPORT SQL DETAILS tag instead of using a call like that.

I believe the $1 argument can be passed into the script as a variable, so I don’t have to create 20 scripts, one for each Employee Entity.

Still no luck.

No that is not how you pass a variable into a CALL.

If you need a variable you should use a propper {CALL:handler.function(‘variable’)} syntax and use a function to call the sql script.

I am still not sure it will work though.

So, I should write a JScript script, with a function that does SQL calls?

Yes try that… Here is an example of a sql query as a variable in a function.

function processFailedPosts()
{
  var tid=0;
  var oid=0;
  
  var lqry = "SELECT [Value] FROM [ProgramSettingValues] WHERE [Name]='PD_Failed_Postings'";
  var failedPosts = sql.Query(lqry).First;
  if (failedPosts=='')
  {
    return 0;
  }
  
  failedPosts = failedPosts.split(',');
  var failedPostsCount = failedPosts.length;
  //return failedPostsCount;
  
  var datafields = getDataFields();
  var datafieldscount = datafields.length;
  
  for (var f=0; f<failedPostsCount; f++)
  {
    var pair = failedPosts[f].split('~');
    tid = pair[0];
    oid = pair[1];
    
    var qry = "";
    qry += "SELECT";
    for (var d=0; d < datafieldscount; d++)
    {
      qry += (d>0 ? " ," : " ");
      qry += "[" + datafields[d] + "]";
    }
    qry += " FROM [Orders]";
    qry += " WHERE 1=1";
    qry += " AND [TicketId] = " + tid;
    qry += " AND [Id] = " + oid;
    //qry += " AND [OrderNumber] = " + onm;
    //qry += " AND [OrderUid] = '" + ouid + "'";
    //qry += " ORDER BY [Id]";
  
    var qryresult = sql.Query(qry).Delimit('~').First;
    var qrydata = qryresult.split('~');
    var qryfieldcount = qrydata.length;  

    var data = new Object();
  
    for (var d=0; d < datafieldscount; d++)
    {
      data[datafields[d]] = qrydata[d];
    }
  
    var jsondata = JSON.stringify(data);
    //return jsondata;

    // Post missed Data to server
    var res = web.PostJson(url,jsondata,usr,pwd);

    if (res == "SUCCESS")
    {
      // remove missed Post data from DB
      var rval = tid+"~"+oid+",";
      var uqry = "UPDATE [ProgramSettingValues] SET [Value]=(REPLACE([Value],'"+rval+"','')) WHERE [Name]='PD_Failed_Postings'";
      sql.ExecSql(uqry);
      var rval = tid+"~"+oid;
      uqry = "UPDATE [ProgramSettingValues] SET [Value]=(REPLACE([Value],'"+rval+"','')) WHERE [Name]='PD_Failed_Postings'";
      sql.ExecSql(uqry);
    }
  }
  return 0;
}

How would I call that? Like this?:
{CALL:handler.processFailedPosts($1)}

You could try {CALL:handler.function(’$1’)}

So if your handler is John and function is stacy() it would be {CALL:John.stacy(’$1’)}

So yours would be {CALL:clockinTimeNew.clockIn(’$1’)}

In the variable you need to do "+name+"

Still no dice.