Prevent nulldate() output via Rest API
Question
Application Type
Reactive
Service Studio Version
11.10.18 (Build 41211)

Hello,
in my app I output various dates among other things. In the app itself, I suppress the display of the nulldate() by controlling the visible property of the container via

"GetFuelCellSampleDBS.List.Current.FuelCellSample.DateOfDecalCoating <> NullDate()".

When I query the data using Rest API, I get the nulldate() = "1900-01-01".

How do I make the response of the Rest API for a nulldate() = ""?

Thanks.

Best regards,
Michael

Champion

Hi Michael,


In Outsystems, variable with date type, when empty will be filled with default "1900-01-01".

My suggestion is :

1. you can use Text data type to get the date

2. you can use if, if date = 1900-01-01 then empty logic


Thanks

Hello @Michael Guenther,

In your REST API's 'On After Response ' property, you may create a call back action to implement logic as shown below:

if(GetFuelCellSampleDBS.List.Current.FuelCellSample.DateOfDecalCoating = NullDate(), "", GetFuelCellSampleDBS.List.Current.FuelCellSample.DateOfDecalCoating)

If you are unfamiliar with the 'OnAfterResponse ' call back action please check this out.

Hope this helps,

AJ

Hi =AJ=, thank you for your answer. 

I am relatively new to Outsystems and despite the good description of your solution, I am a bit lost.

In my "Expose Rest API" I found the property "On Response" under advanced and can select "New On Response" (1).

With a double click on (2) I can open the associated logic.

But now I am stuck. How do I integrate the IF query you suggested into the logic?

Thanks a lot and best regards.

Michael

Hello @Michael Guenther,

The sample code in my previous post is just to give you an idea to replace NullDate() (which is "1900-01-01" in the database) with an empty string. You may not be able to use the sample code 'as is' for the variable specified therein.

In your 'Response' text, once you identify the date value that relates to "DateOfDecalCoating", you should be able to use a condition similar to the sample code. 

Alternatively please share the relevant portion with the date value in your response string.

There are other options. If the source data is managed by you, then you could replace the NullDate() with a blank by using a conditional (if) statement before the API processes the request as well.

Regards,

AJ

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.