Welcome! Log In Create A New Profile

Advanced

How can I get a date field in an Array to stay empty

Posted by rdj 
rdj
How can I get a date field in an Array to stay empty
March 31, 2021 11:31AM
Hi,
I read a query in an array and then loop that array to update some fields that are not in the query
on of the actions is checking based on a certain code if a date field needs to be calculated/filled.
when this field is not needed I fill this with "" and it shows that way in my 'to add array structure'. Only when I add this with arrayaddline in my array the 'empty' date fields are now filled with the current date (as standard for date) how can I keep this date field empty when needed. theoretically the correct date can be the date of today and I use this array further in my program to show in tables etc
I can off-course calculate this date when adding a table row only this means that I have to calculate it every time on the fly and not once only this means that I have to add the calculate every time I need this (multiple tables, reports, etc) and would like to reduce that work and define it only when I fill the array
any good solution for this?

fyi I use this date field in some other steps of my array 'update' to determine some other fields to be set or not (or calculate with this date)

kind regards,

RdJ
Windev 2024/Webdev 2024



Edited 1 time(s). Last edit at 03/31/2021 11:43AM by rdj.
Re: How can I get a date field in an Array to stay empty
March 31, 2021 12:02PM
Hi,
See the help here:
[help.windev.com]
and here:
[help.windev.com]

Regards
Steven Sitas
rdj
Re: How can I get a date field in an Array to stay empty
March 31, 2021 12:50PM
Hi Steven,

That tells me that the date is always filled with the current date at initialization (what is my problem as I described) because I want to keep it empty (null) just like I can do in a hfsql file
Setting a default date is still a date and I need this field to be empty (will influence also all other functions that use the current date at that time).

Or have I misread/misunderstood the help?

what happens is the following:
I have a field that can contain a code (f.e. M/Su2 -> means every month the second Sunday) or can be empty (so no default dates are available)
So based on this field I calculate the dates and get returned empty if this code is not filled (or wrong) (calculated from the current date)
when I then add these date values (for the upcoming 12 periods) to my array this works when the date is filled when the date is empty I get the current date (as described in the help) I need this date field then to be empty because no date is calculated.

So what I want to do is to avoid that I have to calculate it every time and have them 'available' (what also means null/empty if needed). If this "null/empty" not possible in an array I have to do the calculation 'on the fly' every time

kind regards,

RdJ
Windev 2024/Webdev 2024
pao
Re: How can I get a date field in an Array to stay empty
March 31, 2021 01:18PM
If it's only to store the values just define the members as strings instead of dates.

Regards

Paulo Oliveira
Re: How can I get a date field in an Array to stay empty
April 01, 2021 09:31AM
Hi

Use DateTimeByDefault with blank values. That will solve your problem.
I have this as a global setting in most my projects initialisation code as in a lot of cases a defaulting to the system date and time at declaration makes no sense.

Help: DateTimeByDefault

Cheers

Peter Holemans



Edited 1 time(s). Last edit at 04/01/2021 09:32AM by PeHoBe.
Re: How can I get a date field in an Array to stay empty
April 01, 2021 10:13AM
What about that, still learning after all these years thumbs up

Arie
rdj
Re: How can I get a date field in an Array to stay empty
April 01, 2021 10:41AM
thanks

kind regards,

RdJ
Windev 2024/Webdev 2024
pao
Re: How can I get a date field in an Array to stay empty
April 01, 2021 01:02PM
DateTimeByDefault is new to me, still learning thumbs up

Regards

Paulo Oliveira
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: