Skip to main content
swapnar6405
March 30, 2023
Solved

How to get Top 1 record from database table using expression rule

  • March 30, 2023
  • 3 replies
  • 0 views

Hi,

I have an expression rule which is returning data from the database table.

Now, I would like to get a latest db record using that expression rule.

How can I achieve this.

Any advises please.

Thanks.

Best answer by sanchitg0002

Yo can apply paging and sorting configuration by passing pagingInfo in your query with startIndex and batchSize equal to 1 and sort: sortInfo("primaryKey",false)

3 replies

March 30, 2023

Yo can apply paging and sorting configuration by passing pagingInfo in your query with startIndex and batchSize equal to 1 and sort: sortInfo("primaryKey",false)

harshitb6843
March 30, 2023

Please use the key-value pair while passing such values. 

 sortInfo(field: "primaryKey",ascending: false)

March 30, 2023

Yes, I just explained from the top and left that for author. Although it will work that way also as long as we are passing correct values to each input in right order, but yeah it should be a practice to use key-value pair for such operations.