Page 1 of 1

Issue using Datetime column with null values

Posted: Tue Sep 24, 2019 10:19 am
by zalak
Hello,

I have 2 datetime columns in my table, e.g. MyDataTable.tempDateOne & MyDataTable.tempDateTwo.

I want to add a new calculated column to the table using expression "IIF(MyDataTable.tempDateTwo == null, MyDataTable.tempOldValue, MyDataTable.tempNewValue)". But, I guess the condition 'MyDataTable.tempDataTwo == null' does not work correctly.

For testing, I used a databand and added textbox with a condition "IIF(MyDataTable.tempDateTwo == null, "no value", "has value")" and databand never shows "no value" instead shows a blank. But if the 'MyDataTable.tempDateTwo' has value it displays 'has value'. I have attach a screenshot of the databand output.

Is there any way if I can check whether the 'MyDataTable.tempDateTwo' column has value or is null or is empty?

How can I fix this problem?

Thanks & Regards,
Zalak Dobaria

Re: Issue using Datetime column with null values

Posted: Tue Sep 24, 2019 10:51 am
by zalak
Just to add, if I had highlight condition on the text box where in I check IsNull for column 'MyDataTable.tempDateTwo' it works correctly.
See the screen shot

Re: Issue using Datetime column with null values

Posted: Tue Sep 24, 2019 9:16 pm
by Lech Kulikowski
Hello,

Please send us a sample report with test data which reproduces the issue for analysis.

Thank you.

Re: Issue using Datetime column with null values

Posted: Wed Sep 25, 2019 6:31 am
by zalak
Hello,

Please find attached the sample for the issue.

Regards,
Zalak

Re: Issue using Datetime column with null values

Posted: Fri Sep 27, 2019 5:36 am
by zalak
Hello,

Any update? I hope the sample report is working.

Regards,
Zalak

Re: Issue using Datetime column with null values

Posted: Sun Sep 29, 2019 1:32 pm
by Lech Kulikowski
Hello,

Please clarify what is wrong with sample report?

Also, please clarify which version are you use?

Thank you.

Re: Issue using Datetime column with null values

Posted: Mon Sep 30, 2019 6:30 am
by zalak
Hello,

As you asked for a sample I had attached the sample.mrt report to clarify my issue. In the sample.rpt report, there is a table 'Statement' which has column 'Date' and to illustrate the problem of nullable datetime columns I added a new calculated column 'DateTwo' with this expression 'DateTime.Parse(IIF(Statement.InvoiceNumber == 974212 || Statement.InvoiceNumber == 147212, null, Statement.Date).ToString())' just to get a 2 rows with null values for this newly added column i.e. 'DateTwo'.

Now, the issue is as I described earlier, when I want a new calculated column using expression "IIF(Statement.DateTwo == null, "dateTwoNull","notNUll").ToString()" the databand never displays 'dateTwoNull', i.e. the value true for 'Statement.DateTwo == null' is never displayed. See the screen shot.

In my project what I need is, if the datetime column has null values then take data from one column, if it is not null then take data from another column.

Is there any way if I can check whether the 'Statement.DateTwo' column is null or is empty or has a value?

We are using version 2019.1.1.0.
Lech Kulikowski wrote: Sun Sep 29, 2019 1:32 pm Hello,

Please clarify what is wrong with sample report?

Also, please clarify which version are you use?

Thank you.

Re: Issue using Datetime column with null values

Posted: Tue Oct 01, 2019 9:19 pm
by Lech Kulikowski
Hello,

Please check the modified report.

Thank you.

Re: Issue using Datetime column with null values

Posted: Thu Nov 07, 2019 9:46 pm
by David334
I am running into a similar issue. My problem though it I am not able to load this sample.mrt because I dont have a full copy of this software it seems. I only have some limited version provided to me by some other software that uses stimulsoft for its reporting.

Would you be able to explain the answer to this in this post without needing provide a report file?

Re: Issue using Datetime column with null values

Posted: Tue Nov 12, 2019 8:03 am
by Lech Kulikowski
Hello,

In the Interpretation mode, it is not possible to use IIF() function for that task, need to use the conditional operator ?:

Thank you.