Need a special offer?Find out if your project fits.
+

show embedded json object

Answered
Michel Roger asked on July 6, 2020

Hello,
 
I am trying to display the correct data on the table from my json datasoruce for datatime field represented below, but it does not display correctly. Any help is appreciated it .

"systemUpdatedDate": {
"$date": "2020-06-12T15:54:51.556Z"
}

as this 

mapping: {
'systemUpdatedDate.$date': {
type: 'datetime'
},

11 answers

Public
Milena Pechura Milena Pechura Flexmonster July 7, 2020

Hello, Michel, 
 
Thank you for writing to us.  
 
Please note that nested JSON format is not supported in Flexmonster. Further details could be found in Connecting to JSON article.
 
We recommend preprocessing your data to the plain format:

  {
    "$date": "2020-06-12T15:54:51.556Z" 
  }

"systemUpdatedDate" could be defined as a dimension using dimensionUniqueName and dimensionCaption

We would like to mention that array data type is not available in the component. The possible workaround is to split the array into several objects.
Please change this structure:  


“key1”: “value1”,
“key2”: [“value21”, “value22”] 
}

 to this


“key1”: “value1”,
“key2”: “value21” 
},
{
“key1”: “value1”, 
“key2”: “value22” 
}

Also, to display all fields on the grid when using Mapping, an empty object should be specified for every field: "fieldName":{}
This works with JSON format, while when using CSV these fields could be just skipped. 
 
Please have a look at the example we have prepared for you. 
 
Do not hesitate to contact us in case additional questions appear. 
 
Regards,   
Milena

Public
Milena Pechura Milena Pechura Flexmonster July 9, 2020

Hello, Michel,
 
We have received your email about dimensionUniqueName and dimensionCaption, please see our answer below.

These properties should be defined in the Mapping object, and are used to group several fields under one dimension. Please see the following code snippet for the reference:

mapping: {
"$date": {
dimensionCaption: "systemUpdatedDate",
dimensionUniqueName: "systemUpdatedDate"
}
}

Please let us know if you have any additional questions.

Regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster July 16, 2020

Hello, Michel,
 
Our team is interested in whether you tried preprocessing your data to the plain format.
Were our responses helpful, or perhaps you still have any questions we can help you with? 
 
Looking forward to hearing from you.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster July 24, 2020

Hello, Michel,
 
We were wondering if our response helped you with your question.
Please let us know if it worked for your case.
 
Looking forward to your response.
 
Kind regards,
Milena

Public
Michel Roger September 28, 2020

Hi milena,
No I was not able to display the data, it is not possible for me to change the data on the database, if there is any other way that the application can preprocess the data based on a function that we pass for that specific field?

Public
Milena Pechura Milena Pechura Flexmonster September 30, 2020

Hello, Michel,
 
Thank you for giving an update on your progress.
 
Our team would like to confirm that it is possible to modify the data passed to Flexmonster without applying changes to the database.
 
We suggest preprocessing your data to the plain JSON using a server-side or client-side script. Please note that writing a server-side script is a more efficient approach.
The script should take nested JSON, change it to the plain JSON, and return the new dataset. Please specify the link to the script in the 'filename' property of the data source object.
 
Do not hesitate to contact us if any further questions arise.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster October 15, 2020

Hello, Michel,
 
We are just checking in to ask if you’ve found our response helpful.
Have you tried writing the script to preprocess your data? 
 
Looking forward to hearing from you.
 
Kind regards,
Milena

Public
Michel Roger October 15, 2020

Hello Milena,
I would prefer to have a life cycle hook on the front end that will evaluate each row and transform based on a map function without to modified the data on the backend since it will required to create a view on the database which i dont have access.
 
Michel

Public
Milena Pechura Milena Pechura Flexmonster October 16, 2020

Hello, Michel,
 
Thank you for providing details about the desired preprocess logic.
 
Taking into account your case, we would like to confirm that it is possible to create a hook on the frontend.
To pass the data to Flexmonster after preprocessing, we suggest using Ajax. Further details about this approach can be found in the following forum thread: https://www.flexmonster.com/question/execute-a-function-behind-filename-get-url-execution/#answer-18991
 
Please keep us posted on your progress and do not hesitate to contact us in case any questions arise.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster November 4, 2020

Hi, Michel,
 
Hope you are doing well!
 
Our team would like to kindly take an interest in whether you tried the suggested approach. Could you please let us know if it helped?
 
We would be happy to hear your feedback.
 
Kind regards,
Milena 

Public
Milena Pechura Milena Pechura Flexmonster November 11, 2020

Hello, Michel,
 
How are you?
 
We are just checking in to ask if you have found our response helpful.
Have you tried the approach with Ajax? Does it work for you?
 
Waiting for your reply.
 
Best regards,
Milena

Please login or Register to Submit Answer