Table trouble

(imported topic written by SystemAdmin)

I have a clause that I need formatted in a table:

(names of it, last login times of it, number of issued actions of it, (number of issued actions whose (time issued of it > (now - (30 * day))) of it)) of bes users

I’ve tried this and several other variations i’ve found while searching the forums but I keep coming up short. Any suggestions? thanks -Baraq

<table border=1> <th>Operator</th><th>Last login</th><th>Total Actions</th><th>Actions Past 30 Days</th> <?Relevance trs of ( td of names of it & td of last login times of it & td of number of issued actions of it & td of (number of issued actions whose (time issued of it > (now - (30 * day))) of it) ) of bes users whose (name of it contains 
"-co")   ?> </table>

(imported comment written by Lee Wei)

You are very very close. TD operates on a string object, but some of the values are integer and time, so we need to cast them into strings first.

<table border=1> <th>Operator</th><th>Last login</th><th>Total Actions</th><th>Actions Past 30 Days</th> <?Relevance trs of ( td of names of it & td of (last login times of it as string) & td of (number of issued actions of it as string) & td of ((number of issued actions whose (time issued of it > (now - (30 * day))) of it) as string) ) of bes users whose (name of it contains 
"-co") ?> </table>

(imported comment written by Lee Wei)

Sometimes the default time format can be a little hard to read and sort. So here is one for reference.

<table border=1> <th>Operator</th><th>Last login</th><th>Total Actions</th><th>Actions Past 30 Days</th> <?Relevance trs of ( td of names of it & td of ( (year of it as string & 
"/" & month of it as two digits & 
"/" & day_of_month of it as two digits) of date(local time zone) of it & 
" "& (two digit hour of it as string & 
":" & two digit minute of it as string & 
":" & two digit second of it as string) of time (local time zone) of it) of (last login times of it) & td of (number of issued actions of it as string) & td of ((number of issued actions whose (time issued of it > (now - (30 * day))) of it) as string) ) of bes users whose (name of it contains 
"-co") ?> </table>

which formats the time to look like this:

2010/11/18 10:41:45

Lee Wei

(imported comment written by SystemAdmin)

Hey, thanks for the quick response!

I tried it in my pres debugger but it returned:

Singular expression refers to nonexistent object.

Which means means i’m querying something that doesn’t exist? but I’m able to run this as a string ok in the pres debug.

edit:

hmm. looks like login times clause is what’s stopping me up now.

td of ( (year of it as string & 
"/" & month of it as two digits & 
"/" & day_of_month of it as two digits) of date(local time zone) of it & 
" "& (two digit hour of it as string & 
":" & two digit minute of it as string & 
":" & two digit second of it as string) of time (local time zone) of it) of (last login times of it) &

(imported comment written by SystemAdmin)

This error happens when you try to query a property of something that doesn’t exist. My guess is that you have operators who’ve never logged on, so they do not have a “last login time”.

Give this expression a shot:

trs of ( td of names of it & td of ( 

if ( exists last login times of it ) then ( ( year of it as string & 
"/" & month of it as two digits & 
"/" & day_of_month of it as two digits ) of date ( local time zone ) of it & 
" "& ( two digit hour of it as string & 
":" & two digit minute of it as string & 
":" & two digit second of it as string ) of time ( local time zone ) of it ) of ( last login times of it ) 

else 
"Never" ) & td of ( number of issued actions of it as string ) & td of ( ( number of issued actions whose ( time issued of it > ( now - ( 30 * day ) ) ) of it ) as string ) ) of bes users whose ( name of it contains 
"" )

(imported comment written by SystemAdmin)

wow, you hit that one on the head!

Looked at my console users and that was indeed the case.

Works perfectly now… You guys rock! thanks a ton.

-Baraq