Issue using Datetime column with null values
Issue using Datetime column with null values
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
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
- Attachments
-
- Stimulsoft_DateColumn.png (8.98 KiB) Viewed 7353 times
Re: Issue using Datetime column with null values
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
See the screen shot
- Attachments
-
- Hightlight condition
- Stimulsoft_DateColumn_InBuiltCondition.png (8.63 KiB) Viewed 7351 times
-
- Posts: 7339
- Joined: Tue Mar 20, 2018 5:34 am
Re: Issue using Datetime column with null values
Hello,
Please send us a sample report with test data which reproduces the issue for analysis.
Thank you.
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
Hello,
Please find attached the sample for the issue.
Regards,
Zalak
Please find attached the sample for the issue.
Regards,
Zalak
- Attachments
-
- Sample.mrt
- (121.61 KiB) Downloaded 634 times
Re: Issue using Datetime column with null values
Hello,
Any update? I hope the sample report is working.
Regards,
Zalak
Any update? I hope the sample report is working.
Regards,
Zalak
-
- Posts: 7339
- Joined: Tue Mar 20, 2018 5:34 am
Re: Issue using Datetime column with null values
Hello,
Please clarify what is wrong with sample report?
Also, please clarify which version are you use?
Thank you.
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
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.
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.
- Attachments
-
- Stimulsoft_SampleReport.png (14.24 KiB) Viewed 7300 times
-
- Posts: 7339
- Joined: Tue Mar 20, 2018 5:34 am
Re: Issue using Datetime column with null values
Hello,
Please check the modified report.
Thank you.
Please check the modified report.
Thank you.
- Attachments
-
- Sample modified.mrt
- (121.59 KiB) Downloaded 921 times
Re: Issue using Datetime column with null values
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?
Would you be able to explain the answer to this in this post without needing provide a report file?
-
- Posts: 7339
- Joined: Tue Mar 20, 2018 5:34 am
Re: Issue using Datetime column with null values
Hello,
In the Interpretation mode, it is not possible to use IIF() function for that task, need to use the conditional operator ?:
Thank you.
In the Interpretation mode, it is not possible to use IIF() function for that task, need to use the conditional operator ?:
Thank you.