How to send data in same type when they are saved to templates

Answered
maryam asked on April 28, 2023

Just I have another question, is there any possibility to send data in same type when they are saved to templates and when we set a filter for example "equal". the date is saved in template as a Unix epoch time and when we want to create a filter for example "equal to: ...." is date time. Could the both type be same?
 
Looking forward to hearing from you.
 
Best regards

Nadia Khodakivska created this ticket from #54444

8 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster April 28, 2023

Hello,

Thank you for contacting us.

Kindly note that currently, Flexmonster does not support defining the type of dates while setting the filters. Could you please provide more details on your use case? Why do you need both types to be the same? It would greatly help us.

Looking forward to hearing from you.

Kind regards,
Nadia

Public
maryam May 2, 2023

Thanks Nadia,
Sure. backend should send data with different type and it makes system non-constant.

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster May 2, 2023

Hello,

Thank you for the clarifications.

Kindly note that the filter.query (e.g., "equal" filter) can use both Unix timestamp and ISO 8601 date formats. You are welcome to check the following JSFiddle for reference: https://jsfiddle.net/flexmonster/y8d63cgf/ 

Please let us know if it works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
maryam May 3, 2023

Thanks for the solution. Could it be done in JSON dataSource as well?
I meant this one in the attached image. Could it be Unix timestamp in JSON dataSource?
It should be in the same type with this:
{uniqueName: "sud", aggregation: "max", filter: {members: ["sud.[1591833600000]"]}}
 
I'm looking forward to hearing from you as soon as possible.
 
kind regards

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster May 3, 2023

Hello,

Thank you for the response.

When getting or saving the report (a JSON object), the query filter can only be stored in the ISO 8601 format("2023-05-03"). If you need the type to be constant, we suggest handling the date type conversion on your side.

Feel free to contact us if other questions arise.

Kind regards,
Nadia

Public
maryam May 4, 2023

I see. and as well about {uniqueName: "sud", aggregation: "max", filter: {members: ["sud.[1591833600000]"]}}

It couldn't be sent in the ISO 8601 format?

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster May 4, 2023

Hello,

Thank you for the response.

You are correct that filter.members can only be stored in the Unix timestamp format. Please note that the members property of the Filter object stores the field's members to be shown. The "sud.[1591833600000]" is a member's name that Flexmonster stores in the report using the Unix timestamp format.
If you want to make date types constant, the recommended way is to create an adapter that will get the necessary dates from Flexmonster and convert those dates to the type you choose. Then you can send the dates in the required format to your server side.

You are welcome to contact us in case other questions arise.

Kind regards,
Nadia

Public
maryam May 4, 2023

Cool, thank you for the clarifications.
Best regards

Please login or Register to Submit Answer