Member since
07-29-2020
574
Posts
323
Kudos Received
176
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
1976 | 12-20-2024 05:49 AM | |
2202 | 12-19-2024 08:33 PM | |
2022 | 12-19-2024 06:48 AM | |
1326 | 12-17-2024 12:56 PM | |
1903 | 12-16-2024 04:38 AM |
05-26-2023
07:17 AM
Hi, I think you can achieve this in two shift transformation as follows: [
{
// 1st transformation is basically to isolate
// "OC" value reference into Orders.ValueReference
"operation": "shift",
"spec": {
"Orders": {
"*": {
"Headers": "Orders[#2].&",
"Goods": "Orders[#2].&",
"References": {
"*": {
"TypeReference": {
"OC": {
"@(2,ValueReference)": "Orders[#2].ValueReference"
}
}
}
}
}
}
}
},
//2ed Transformation is the same as you had except for
//fetching the isolated ValueReference above
//into its own Array based on the GoodsDetails array
{
"operation": "shift",
"spec": {
"Orders": {
"*": {
"Headers": "header",
"Goods": {
"*": {
"GoodsDetails": {
"*": {
"@(2,GoodsTypeName)": "rows.GoodsTypeName",
"Packs": "rows.Packs",
"@(4,ValueReference)": "rows.ValueReference"
}
}
}
}
}
}
}
}
] If the helps please accept solution. Thanks
... View more
05-18-2023
11:28 PM
the input files are csv
... View more
05-17-2023
11:31 AM
in Addition to above logic , if the input payload comes as below with number and Date combined in single array field. input: { "FatturaElettronicaBody": { "DatiGenerali": { "DatiGeneraliDocumento": { "TipoDocumento": "TD01", "Numero": "126587", "Data": "16.05.2023", "Divisa": "EUR", "ImportoTotaleDocumento": "7011.10" }, "DatiDDT": [ { "NumeroDDT": "126681-15.05.2023" }, { "NumeroDDT": "12680-10.05.2023" } ] } } } Used the spec below: [ { "operation": "modify-overwrite-beta", "spec": { "FatturaElettronicaBody": { "DatiGenerali": { "DatiDDT": { "*": { "b_NumeroDDT": "=split('[-.]',@(1,NumeroDDT))", "NumeroDDT": "@(1,b_NumeroDDT[0])", "DataDDT": "=concat(@(1,b_NumeroDDT[3]),'-',@(1,b_NumeroDDT[2]),'-',@(1,b_NumeroDDT[1]))" } } } } } }, { "operation": "shift", "spec": { "FatturaElettronicaBody": { "DatiGenerali": { "DatiGeneraliDocumento": "FatturaElettronicaBody.DatiGenerali.&", "DatiDDT": { "*": { "NumeroDDT": "FatturaElettronicaBody.DatiGenerali.DatiDDT[&1].NumeroDDT", "DataDDT": "FatturaElettronicaBody.DatiGenerali.DatiDDT[&1].Date" } } } } } } ] Output: { "FatturaElettronicaBody" : { "DatiGenerali" : { "DatiGeneraliDocumento" : { "TipoDocumento" : "TD01", "Numero" : "126587", "Data" : "16.05.2023", "Divisa" : "EUR", "ImportoTotaleDocumento" : "7011.10" }, "DatiDDT" : [ { "NumeroDDT" : "126681", "Date" : "2023-05-15" }, { "NumeroDDT" : "12680", "Date" : "2023-05-10" } ] } } }
... View more
05-16-2023
05:50 AM
Hi, I noticed you are using "$(cdn)" instead of "${cdn}" for sql.args1.value to probably reference the flow file attribute cdn which you are using as merge key. That is probably why the merge has no effect because its looking for the string "$(cdn)" instead of the attribute value "${cdn}".
... View more
05-13-2023
03:41 AM
Thank you so much too. This also works. But i am actually a learner using Jolt.
... View more
05-12-2023
04:35 AM
@sarithe, What is the format of the record you are trying to convert? What is the data type of the field you are trying to convert? Are you trying to modify the value of a record or the value of an attribute? If you are trying to update the values from within each record, you should try using an UpdateRecord processor, in which you define a Record Writer and a Record Reader. Next, you can add another property in your processor and define it like: Property: /your_column --> pay attention to the slash in front as it is very important. Value: ${field.value:multiply(1000):toNumber():toDate("yyyyMMdd", "GMT"):format("yyyyMMdd")} --> this is just an example, as I do not know how your data looks like and how you want it displayed. You can use NiFi's EL to define the exact format you required, but make sure you use field.value if you want to modify the value from within that specific column.
... View more
05-11-2023
03:50 PM
I think you had it right but you need to convert the division value into string before applying split on it. Here are the steps: "decImporto": "=divide(@(1,Importo),@(3,Quantita))",
"strImporto": "=toString(@(1,decImporto))",
"array_importo": "=split('[.]',@(1,strImporto))",
"pad_importo": "=rightPad(@(1,array_importo[1]), 8, '0')",
"Importo": "=concat(@(1,array_importo[0]),'.',@(1,pad_importo))"
... View more
05-08-2023
09:47 AM
if what you provided seems to be giving you the expected output then you are good to go :).
... View more