Jump to content
  • 0
Fleshzombie

Report that shows most recent date entry for log of items SQL

Question

I have an inventory log which has a running log of items and is timestamped when a new entry is submitted.   Because it is a log it has multiple entries for each item (when the particular item switches hands for example)

I am trying to create a report (using a table with calculated field) which will show the list of items and the last timestamp associated with each item.

 

I created a calculated field and tried:

SELECT TOP 1 Date
FROM tbl_Tablet_Inventory_Log
WHERE DeviceWirelessNumber=[@field:DeviceWirelessNumber]
ORDER BY Date DESC
 

Date is the column from the tbl_Tablet_Inventory_Log with the timestamp,  DeviceWirelessNumber is the column name of item I am trying to match on current table with the calculated field

 

I am getting error:

Invalid formula: Subqueries are not allowed in this context. Only scalar expressions are allowed.

Completely new to sql and would appreciate any help

 

Thanks!

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi @Fleshzombie,

 

The error which you have encountered means that your SELECT expression returns an array of values instead of single value. 

This is a current limitation of Caspio Bridge as far as I know. 

If you need to display multiple values you can create a separate report with the same filtering criteria as in your SQL expression and embed this report in HTML block using the Iframe deploy code. You would need to specify an external parameter (DeviceWirelessNumber=[@field:DeviceWirelessNumber]) in Iframe source URL.

I need to mention that this approach will face some styling issues. 

This article explains how to re-size Iframe:

https://howto.caspio.com/faq/deployment/remove-iframe-border-and-change-size/

Hope this helps.

 

Regards,

vitalikssssss

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×