This time I am using the following manual:
https://techcommunity.microsoft.com/t5/azure-synapse-analytics-blog/extracting-sap-data-using-odata-part-7-delta-extraction-using/bc-p/4202197#M976
We are talking about this picture:
My idea (I assumed that the DeltaToken does increase with time):
@if(equals(activity('ll_delta').output.count, 0), '', max(activity('ll_delta').output.value.DeltaToken))
Error:
The expression 'if(equals(activity('ll_delta').output.count, 0), '', max(activity('ll_delta').output.value.DeltaToken))' cannot be evaluated because property 'DeltaToken' cannot be selected. Array elements can only be selected using an integer index.
His idea:
Order the DeltaToken by its CreatedAt-Time and pull the latest
--> Would anyone mind helping me to achieve this goal? I would appreciate your help
Edit_1
ll_delta:
@concat(pipeline().parameters.URL, pipeline().parameters.ODataService, '/')
Entity:
@concat('DeltaLinksOf', pipeline().parameters.Entity)
Sample Output by ll_delta:
{
"count": 5,
"value": [
{
"DeltaToken": "D20240815145137_000036000",
"CreatedAt": "2024-08-15T14:51:37Z",
"IsInitialLoad": true
},
{
"DeltaToken": "D20240815171231_000021000",
"CreatedAt": "2024-08-15T17:12:31Z",
"IsInitialLoad": false
},
{
"DeltaToken": "D20240816091538_000017000",
"CreatedAt": "2024-08-16T09:15:38Z",
"IsInitialLoad": false
},
{
"DeltaToken": "D20240816091955_000036000",
"CreatedAt": "2024-08-16T09:19:55Z",
"IsInitialLoad": false
},
{
"DeltaToken": "D20240816092232_000119000",
"CreatedAt": "2024-08-16T09:22:32Z",
"IsInitialLoad": false
}
],...
Our solution/workaround for now within activity Set variable/v_deltatoken (it does work):
@if(equals(activity('ll_delta').output.count, 0), '', last(activity('ll_delta').output.value).DeltaToken)
Issues:
Order the DeltaToken by its CreatedAt-Time and pull the latest
To achieve your requirement, you need to first get the max CreatedAt
and based on it you need to filter the output.
Here is the sample solution I tried with sample data you provided:
CreatedAt
using the Foreach activity and set variables.Pass the Lookup output to for each activity as below:
Under Foreach activity take two set variables of string type and as initial date, max date to get the max CreatedAt
date as below:
After this you will get the latest values.
OUTPUT: