haggart

SQL troubleshooting

Discussion created by haggart on Jan 5, 2018
Latest reply on Jan 8, 2018 by philmodjunk

I am baffled by something that should be simple to figure out.

 

I am trying to generate a list of spending by each person in our lab for the previous year.

 

ExecuteSQL("SELECT SUM(TotalCost)

FROM Orders

WHERE UserRecordCreatedBy = ?

AND DateOrderYear = ?";"";"";Orders::UserRecordCreatedBy;Year(Get(CurrentDate)-365) )

 

What I get when I use this field in a portal (sorted from high to low) is a list of people with only one person's spending listed (correctly) - everything else is blank.

 

Screen Shot 2018-01-05 at 3.34.21 PM.png

 

I have a second copy of this database on a local computer.  The formula looks the same as the one used on a remote server...

 

ExecuteSQL("SELECT SUM(TotalCost)

FROM Orders

WHERE UserRecordCreatedBy = ?

AND DateOrderYear = ?";"";"";Orders::UserRecordCreatedBy;Year(Get(CurrentDate)-365) )

 

Here's what the portal looks like

 

Screen Shot 2018-01-05 at 2.43.53 PM.png

 

What am I missing?  Why would it work in one instance but not another?  Please point me in a direction where I can try to solve this.  I'm thinking it's something obvious, but I'm just missing it.

 

Many thanks,

Mallory

Outcomes