how to parse json and create trigger based on incoming json data - odbc

Hi I want to monitor postgres database using ODBC and to show notification based on condition, I'm creating item with db.odbc.get[,{$DSN_NAME}], please find the screen shot my item configuration.
I can be able to get data, please find the below screen of receiving data
Now I want to process this data and to show notification for user that these jobs are failed if status equals 8, I have tried it with trigger, but I can't get rid of it.
please find the screen shot for trigger configuration and also error that has been occured
The following error is occured
Can any one help me on this, and also please correct me if my approach is wrong, since I'm very new for this.
I'm also trying with low level discovery, but I don't exact way of doing it,
I have tried below where I'm facing the following issue that
Cannot create item: item with the same key "db.odbc.select[testing_odbc {#job_name},{$DSN_NAME}]" already exists.
.
Find the screen shot of discovery rule below
Then I'm creating item prototype as below
please find the sample data from discovery rule
{
"data":[{"job_name":"job1","job_status":1},{"job_name":"job2","job_status":0},{"job_name":"job3","job_status":2}]
}
I'm scheduling the discovery rule for every 20 seconds and item prototype for every 30 seconds, and I guess for every 20 seconds it's trying to create item with same id as before.
How to resolve and for the sql query in item prototype what need to give.

That JSON text is not a number, so you can't compare it to a number.
Options:
change your query to return a number.
Use JSONPath preprocessing to select the number from the JSON (ie: $[0]["Status"])

Related

Need help to iterate through array of JSON response in TOSCA

I just started working on TOSCA, I need one help with the technical issue which I am facing now.
I have an API which sends a array of objects and my test condition should validate a particular field in all objects in array.
In TOSCA when I scanned my API, I see an item attribute is created and that has all fields within it.As per the source I see that we can extract any data from the item either by making the item as "$index" or by setting the value as index==1(index value).
or like this
But I don't want to iterate like this as for each test data, the number of items may vary and I don't want to hard code the response by index.As it fails with a new data set as below
With one test data I got four records and in next iteration response has only three records and also data updated so the verification is failed.
Can someone help me to find out a solution to iterate / loop through all items at once(using some loops) and extract data into buffer.

Looker Alert Issue

I am new to Looker and trying to create my first alert. The requirement is simple when a status field (calculated field) is greater than 1 looker should send an email. Though a couple of records value is more than 1 still not sending an alert. I didn’t schedule a delivery, just created an alert.
FYI: Row count exceeds 5000
I wanted the Looker to check every 15 min if the calculated field is greater than 1.
attached is the Snap of the alert
Can anyone please help me with what needs to be done?
TIA
Your setup looks correct. Check your permission and do a test run before scheduling the email.

D365FO Tile count on workspace doesn't work

Situation is next one:
I created several tiles. Every tile need to show count of records.
Tile "Expired Active Contracts" always shows zero.
There is created simple query with data source table Contract. Ranges are added (ContractStatus; Value: 2) and (ValidTo; Value: (LessThanDate(0)) )
When it's clicked on tile, it opens valid form with valid record, where contracts status is active (2) and ValidTo are any date before today's date, but count doesn't working.
Tried to recreate, tried several things but definitely nothing. ValidTo field is date field.
Some time ago I had a mistake very similar to yours in my dev environment, this steps help me to fix the error.
1 - Clear Usages Data.
2 - SysAdmin/Setup/Data cache/Tile data cache configuration. Select
the tiles which are running into this issue and then delete the
selected tiles.
3- In VS rebuilt and Synchronized the Solution.
4 - Finally refresh the Application browser.
Another thing is that a while ago there was a problem for tiles refresh
Issue 243278 Workspace tile does not update correctly when reusing the
same name
https://fix.lcs.dynamics.com/Issue/Details?bugId=243278&dbType=3&qc=68b6dc6804c9cea218daa102968c7acfcdfe6a990e80e0b5ec66b920a680fceb
I hope you find it useful

Powerapps - get stuck with UpdateContext

I am trying to build a PowerApp to log setup times of our machines by our fitters.
This is what my app looks like:
There are buttons named "Uhrzeit". Pressing these will write the current date and time into the Date/Time fields. I am using the following code:
UpdateContext({Total8:(Text( Now(); "[$-de-DE]dd/mm/yyyy hh:mm:ss" ))})
The Date/Time field is named Total8.
The code is working well but after saving the form and opening a new record the old data is still available in the fields. By clicking on the button "Zeiten zurücksetzen" I can "delete" the old data.
UpdateContext({Total8:""})
Problem: When I open one of the older records the old data is not available in the form. There is only the value of the last record. In the Common Data Service where my records are saved the values are correct.
As an example, I am saving this record:
When I open a new record, the values of the record 1 are still available. This should not be the case if my app worked properly.
For your Information:
If I enter the date/time without tapping the button, saving the record and opening a new record I don't have the problem. I think the "UpdateContext" code is not the code I should use here.
Can anyone help me solve the problem?
I don't think there's a problem with using the contexts in this way -- but remember that a context is just a variable. It isn't automatically linked to a datasource in any special way - so if you set it equal to Now(), it's going to keep that value until you do something different.
When you view an old record, you need to get the data from CDS and update your contexts to match the CDS data. Does this make sense?
Yeah thats my problem.
I want the variable to be linked to a datasource. Or is it possible to write the date/time into the fields without using a context variable?

Please read scenario below and help me to solve it

I have asp.net web page which populates grid view. One of column is Status which can have (Scheduled, InProgress, Failed, OnHold, Completed) these values and another column with link in each row to edit that particular entry. Editing is only allowed for statuses Failed, OnHold, Completed not for Scheduled, InProgress on click of entry which has status Scheduled or InProgress a pop up appears saying you cannot edit.
Now, click on link and start editing data, at same time another person with same access as mine also tries to edit same data(i.e. clicks on same link) and makes Status to Scheduled and clicks submit. The data is saved in database. Before I complete editing.
Now status for that entry is Scheduled and according to requirement it cannot be edited, but I'm able to edit data and save it database.
It should not happen. How to achieve this please help.
Thanks in advance
On the function or RowUpdating Event of the grid, you should run a SQL statement checking if the status of the row currently being updated is valid for saving (per your requirements).
If it's not, then display an error that it's been updated by someone else to a status different from the one fetched by the 2nd user trying to update it.
You can make a Column in your database like "IsEdited" and whenever a record is being inserted first run a query to retrieve the value of "IsEdited" then use If-Else statement to check. If its value is True then don't run the Insert query and display error message and if its value is False then run the Insert query with data for all other columns and also a value (True) for "IsEdited" column.
If you could provide a code it would be easy to explain.

Resources