Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm trying to create an Alert (Qlik Alerting SaaS) when a new record is loaded. Any idea on how to create a measure to compare it.
The alert must be trigger when a new IDORDER is loaded on the app.
ok... I managed it on script.
1.
Let ThisExecTime = Timestamp(ConvertToLocalTime(Now(),'Brasilia',true),'YYYY-MM-DD hh:mm:ss');
[LASTLOAD]: //new table to store the last values.
Load
max(IDCAMPOCHECK) AS LASTIDCAMPOCHECK, //max to get the last loaded ID.
'$(ThisExecTime)' AS LASTTIME, //last load time for control only, not necessary for create the alert.
if(max(IDCAMPOCHECK) = '$(LastIDCampoCheck)', 0, 1) AS FLNEW //compare the current loaded max ID, with the last value stored on the variable bellow. flag 0 is not new and 1 if new.
Resident [CAMPOCHECK];
//create the variable to store the last id loaded.
Let LastIDCampoCheck = Peek('LASTIDCAMPOCHECK',0,'LASTLOAD');
2. then create a new measure name NEW ID = sum(FLNEW);
3. create an alert using the NEW ID measure, and if its greater than 0, the alert is triggered.
Please create one measure like
If(RowNo(TOTAL)>Count(FieldName), 1,0)
Then created on alert based on this measure and see if that works?
Hi... I got your idea, but it didn't worked as expected. I expect that only new records after reloading count for the alert.
The ID 89 was the last one loaded, and it is new in the firsts reload. But after reloading the app one more time, it is still considering this as a new record (count new is your suggested formula), and it should not.
Let me you if I missed something. Thank you!
How complex model you have?
If you meant data model... I can't print it it here from de data model, but there is:
5 fact tables linked and 7 dimension tables... not complex in my perspective and few records for now.
ok... I managed it on script.
1.
Let ThisExecTime = Timestamp(ConvertToLocalTime(Now(),'Brasilia',true),'YYYY-MM-DD hh:mm:ss');
[LASTLOAD]: //new table to store the last values.
Load
max(IDCAMPOCHECK) AS LASTIDCAMPOCHECK, //max to get the last loaded ID.
'$(ThisExecTime)' AS LASTTIME, //last load time for control only, not necessary for create the alert.
if(max(IDCAMPOCHECK) = '$(LastIDCampoCheck)', 0, 1) AS FLNEW //compare the current loaded max ID, with the last value stored on the variable bellow. flag 0 is not new and 1 if new.
Resident [CAMPOCHECK];
//create the variable to store the last id loaded.
Let LastIDCampoCheck = Peek('LASTIDCAMPOCHECK',0,'LASTLOAD');
2. then create a new measure name NEW ID = sum(FLNEW);
3. create an alert using the NEW ID measure, and if its greater than 0, the alert is triggered.
This worked perfectly for my situation. Thank you!