Jump to content
  • 0

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!

 

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

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...