Json model undo data changes - json

I have a sap.m.table which is binded to a JSON "TRIP" model.
Each row of the table got a change button, that opens up a dialog to change the value for columns for that particular row. On change button click i am saving the original values in "temp" JSON model.
There is a cancel button to close the change dialog,
On cancel button i am getting the original values from "temp" JSON model and setting the values by setProperty() in the "TRIP" JSOn model. As soon as any values are manually changed in the dialog both of the models "TRIP" JSON model and "temp" JSOn model are getting updated with the new values.
I am not able to get the original values from anywhere. I have also tried to do oneway binding on the temp json model but it didn't work.
Please suggest what should i do to store the original values.
Thanks
.

I have use $.extend to clone the temp model.
It has solved the problem.

Related

Dynamically refer to Json value in Data Factory copy

I have ADF CopyRestToADLS activity which correctly saves json complex object to Data Lake storage. But I additionally need to pass one of the json values (myextravalue) to a stored procedure. I tried referencing it in the stored procedure parameter as #{activity('CopyRESTtoADLS').output.myextravalue but I am getting error
The actions CopyRestToADLS refernced by 'inputs' in the action ExectuteStored procedure1 are not defined in the template
{
"items": [1000 items],
"count": 1000,
"myextravalue": 15983444
}
I would like to try to dynamically reference this value because the CopyRestToADLS source REST dataset dynamically calls different REST endpoints so the structure of JSON object is different each time. But the myextravalue is always present in each JSON call.
How is it possible to refernce myextravalue and use it as a parameter?
Rich750
You could create another lookup active on REST data source to get the json value. Then pass it to the Stored Procedure active.
Yes, it will create a new REST request, and it seams to be an easy way to achieve your purpose. Lookup active to get the content of the source and won't save it.
The another solution may be get the value from the copy active output file, after the copy active completed.
I'm glad you solved it by this way:
"I created a Data Flow to read from the folder where Copy Activity saves dynamically named output json filenames. After importing schema from sample file, I selected the myextravalue as the only mapping in the Sink Mapping section."

How to update a property in CSV Data in neo4j

i want to update properties in the relationship by import the csv data in Neo4j.
i have created some labels and relationships from csv data like this:
node,name
1,leo
2,sun
3,wang
4,hi
now i would like to add a property "descripe" in the table.
descripe
leader
pro-leader
crew
crew
how can i add this property into the graph? Just only this new property, i dont want to create the new four labels.
THX
It would be useful if you posted the cypher statements that you used to perform your initial graph creation. Without this it is difficult to know exactly how the update should be written. Essentially though you want to load your csv file containing the new properties, perform a MATCH on the nodes in the graph and then set the properties on these nodes. Assuming that you have created a schema index against your labels it would be something like:
LOAD CSV WITH HEADERS FROM "file:///C:/temp/myfile.csv" AS csvLine
MATCH (n:`Label` { indexedproperty : csvLine.value })
SET n.newproperty = csvLine.newpropertyvalue
where Label is the label you applied to your nodes on creation, indexedproperty is the name of the property you added and indexed, csvLine.value is the lookup value of the indexed property read from the .csv file, csvLine.newpropertyvalue is the new property you wish to add (read from the .csv file).
If you post more details on your graph we can help more precisely.

In Talend, how do you keep input values provided to tSoap so that you can use them with the Soap response?

I have a Talend Job that currently does the following:
Input CSV --Main--> tMap --Output--> tSoap --Main--> Output CSV
The input CSV has
ID and TYPE as input columns.
The Map creates a Soap XML (String) message using the ID from the CSV and passes that String to the tSoap component.
The tSoap component fires the web request, which sends the response to the next component. That data is then written to CSV.
The problem is that TYPE from the input CSV is not passed through to amalgamate with the SOAP response data. Only the response data seems accessible.
I've had a look at tBufferInput / tBufferOutput and tFlowToIterate but they seem to work in scenarios where the tSoap component does not depend on an input from the main flow.
Does anyone know which components can be used to achieve the amalgamation?
Thank you
If you output the data you need to reuse to a tHashOutput component you should be able to rejoin your data with the response output from tSoap assuming there's some natural join element from the response.
I solved this in the end by:
Placing between the output from the tMap and the input to the tSoap, a new component - tSetGlobalVar
Inside tSetGlobalVar, you can then create a new row, which maps an input column (Value) to a named variable that you specify as the 'Key'.
E.g. Key = "ID", Value = row11.ID
The output from tSetGlobalVar then goes into the tSoap component.
The output from tSoap goes into a new tMap.
Inside this new tMap is the Body column from the previous tSoap component which maps to an output column. To access the stored "ID" variable for the current flow/iteration, I created a new output column, and instead of mapping any columns from the inputs, used (String)globalMap.get("ID"); which would insert the value back into the flow.

Filling dojo combobox with json data

I have a json object retrieved from a method which contains user information. I want to set that json object as a store of a dojo combobox. Please help.
So if I understand correctly, you want to use a single object as the store of a combobox (so it would only give 1 option?). If you're trying to use an array of JSON objects as a JSON store, I suggest looking at enter link description here.
As you can see they have a store with inside the data attribute an array of JSON objects.
new Memory({
data: [
...
]
});
Then they create a ComboBox and the most important things are the store and the searchAttr properties. With the store property you can connect your store to the combobox and with the searchAttr property you can say which property of your JSON object is the visible thing that should be displayed in your combobox.

ExtJS grid - how to focus on added row?

I have a grid(gridpanel) and data in it which I read from json query. After I added new bussines object(row) - I send him in json format to server, write to DB, and reload all grid. How I can focus on currently added row(b/o) after that? I will be very cool if I return added id at the json answer and grid take it and focus on row with added id.
Thx.
How is your data being added (append-mode or not?). You can do grid_panel.getView().focusRow(row) on the length of the data array in the store, which will focus on the "last" row that was inserted. Also, you could hook into the rowsinserted event of GridView, and focusRow on the lastRow parameter that's passed in there.