0

I have created a azure storage table and I need to get the last inserted row. I have tried using a filter with something like @equals(int(formatDateTime(item().date,'yyMMddHHmmss')),max(int(formatDateTime(item().date,'yyMMddHHmmss')))) I am open to any ideas

Jed
  • 929
  • 2
  • 19
  • 32
  • Are you trying to get last inserted row from Adf pipeline? – vijaya Dec 01 '22 at 08:38
  • I have a rest call then I copy that json data to an azure table storage and I need the last date inserted as a highwater mark – Jed Dec 02 '22 at 17:02

1 Answers1

0

If you are trying with ADF, kindly note that max() is not supported for azure table storage as specified in this MS Doc of Table Service Query Operators.

enter image description here

Two of the methods for getting the latest entry/row is using the date-time. For example, DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks

This is not good practice if the order is random based on the rowkey.

Another approach is using the Timestamp:

results.OrderByDescending(r => r.Timestamp).FirstOrDefault();

Refer to the SO Thread 1 & 2 for more information.

vijaya
  • 1,525
  • 1
  • 2
  • 6
  • How do I achieve the Ticks way and set a variable within Azure pipelines and not in C# – Jed Dec 03 '22 at 21:13