ExtJS4 Ext Direct form loading with array named fields - forms

I have fields like this (for example only one):
Ext.create("Ext.form.Number", {
name: "field[]",
allowDecimals: true
});
...and I can post nice values. But when I'm trying to load values (form.load({params: {id: 1}})), it returns failure, and doesn't load the values to the fields.
Returned ajax values like this:
{
"type": "rpc",
"tid": 2,
"action": "MyAction",
"method": "getFormData",
"result": {
"field":["5"]
}
}
Can you help me, what should I do? Form can't load array values to array fields?

Array is not a valid type for fields. How would you expect this to work ? ExtJs stores are like tables in a database, model are like the rows.
As you cannot save an array into a field in mysql, you cannot in a field of an ExtJs model either.
You have to model your data differently in two tables instead of one ( main table and details table ). Do it the same way as you would in a database.

Related

In MongoDB, can we get distinct values of a field regardless of hierarchy?

I am creating an application to store and display multiple hierarchies. I am storing json data in nested tree format like the following
{
"text":"Node1",
"children":
[{
"text":"Node2",
"children":[...]
},
{
"text":"Node3",
"children":[...]
}]
}
Is there a way to get the distinct values for the field text regardless of where the field appears in hierarchy. It could be the text of the parent, child, grandchild or further descendants.
Desired output is ["Node1","Node2","Node3",...]

Azure Data Factory - Copy Activity - rest api collection reference

Helo eveyone,
I am fairly new to Data Factory and I need to copy information from Dynamics Business Central's Rest API. I am struggling with the "Details" type entities such as "invoiceSalesHeader".
The api for that entity forces me to provide a header ID as a filter. In that sense, I would have to loop x times (a few thousand) and call the Rest API to retreive the lines of each sales invoice. I find that completely ridiculous and am trying to find other ways to get the information.
To avoid doing that, I am trying to get the information by calling the "salesInvoice" entity and use "$expand=salesInvoiceLines".
That gets me the information I need but inside data factory's Copy Activity, I am struggling with what I should put as a "collection reference" so that I end up with one row per salesInvoiceLine.
The data returned is an array of sales invoices with a sub array of invoice lines.
If I select "salesInvoiceLines" as the collection reference, I end up with "$['value'][0]['salesInvoiceLines']" and that only gives me the lines for the first invoice (since there is an index of zero).
What should I put in Collection Reference so that I get one row per salesInvoiceLine
It is not support to foreach nested json array in ADF.
Alternatively, we can use a Flattern activity in data flow to flatten the nested json array.
Here is my example:
This is my example json data, the structure is like yours:
[
{
"id": 1,
"Value": "January",
"orders":[{"orderid":1,"orderno":"qaz"},{"orderid":2,"orderno":"edc"}]
},
{
"id": 2,
"Value": "February",
"orders":[{"orderid":3,"orderno":"wsx"},{"orderid":4,"orderno":"rfv"}]
},
{
"id": 3,
"Value": "March",
"orders":[{"orderid":5,"orderno":"rfv"},{"orderid":6,"orderno":"tgb"}]
},
{
"id": 11,
"Value": "November",
"orders":[{"orderid":7,"orderno":"yhn"},{"orderid":8,"orderno":"ujm"}]
}
]
In the dataflow, we can select the header of the nested json array, here is orders:
Then we can see the result, we have transposed the JSON orders array with 2 objects (orderid, orderno) into 8 flatten rows:

programatically sort multiple columns at a time

I want to sort multiple columns at a time programatically. I am NOT using the default sorting method which is to click on header name to sort and ctrl/shift key + header name to sort multiple columns. I have a different option in the column options menu which is used to sort that specific column. For single column sort, I am using the following api.
params.api.setSortModel([
{
colId: params.column.colId,
sort: "asc",
}
Is there any api or anyway to sort multiple columns?
You need to construct a sortModel object which looks like this -
var sortModel = [
{
"colId": "athlete",
"sort": "desc"
},
{
"colId": "country",
"sort": "asc"
}
]
Then you can use the sorting api, the way you have used it and pass this model which is just an array containing more than one column instead of single column the way you have it in question
params.api.setSortModel(sortModel);
Example on sorting api.

Is it possible in Grafana using a source data table with a JSON field, to get an attribute from that field?

We configure Grafana to use a table input data source, it works very well with the fields already defined (like time, status, values, etc.).
But now a new field has been added to the table that is a serialized JSON object, returned from a process we can not modify.
We need to use a value (timestamp) that is a property of this serialized object in that table string field.
One serialized field value example is this:
{"timestamp":"2020-02-23T18:25:44.012Z","status":"fail","errors":[{"timestamp":"2020-02-23T18:25:43.511Z","message":"invalid key: key is shorter than minimum 16 bytes"},{"timestamp":"2020-02-23T18:25:43.851Z","message":"unauthorized: authorization not possible"}]}
The pretty print is:
{
"timestamp": "2020-02-23T18:25:44.012Z",
"status": "fail",
"errors": [
{
"timestamp": "2020-02-23T18:25:43.511Z",
"message": "invalid key: key is shorter than minimum 16 bytes"
},
{
"timestamp": "2020-02-23T18:25:43.851Z",
"message": "unauthorized: authorization not possible"
}
]
}
Is there any way to use a value like: field.timestamp or field.errors[0].timestamp ?
Is there a Plugin that allows it ?, or is not possible at all ?
Use PostgreSQL JSON column select in your Grafana query, e.g.:
SELECT
field->'timestamp',
...

SapUI5: Filter Value to databound value in Row Repeater

I created a row repeater. The row repeater template consists of a panel which consists a table.
I have set a model for the row repeater and the tables uses that same model, but with a different path.
The model for the rows of the row repeater as a property LEVEL. Now I want to show in the tables for the rows only the values with the same level. So I tried tried to filter for that value like that:
oTemplateTable.bindRows({
path: "/ROOT_COMPONENT",
sorter: new sap.ui.model.Sorter("NAME"),
filters: [new sap.ui.model.Filter(
"LEVEL",
sap.ui.model.FilterOperator.EQ, "{LEVEL}")]
});
But this did not work. I need some way to get the level value for the row in which the table is in. Has anyone an idea?
Both ROOT_COMPONENT and ROOT_STATISTICS are objects (i.e., {{data},{data}}) containing objects instead of arrays (i.e., [{data}, {data}]) containing objects, so I doubt you will be able to render the RowRepeater correctly
Furthermore, I think the {LEVEL} argument in your filter resolves back to ROOT_COMPONENT (since that's where you're binding your table to) and not ROOT_STATISTICS.
I think you could save yourself a lot of trouble if you could rework your JSON response to a more hierarchic one, so you won't need a filter anyway:
[{
name : "ABC",
tableData : [
{
amount : 20
}]
},
{
name : "DEF",
tableData : [
{
amount : 1
}]
}]
This way you just bind your rowrepeater to the root node, and your table to the relative child tableData