xml nillable date
xml nillable date
How can I test for a nil date in xml data in an expression? I have a report with dates. The dates can be nil. On the report I want to show "----" whenever a date is nil. I've tried various things but could not get it to work. Stimulsoft reads in the xml data fine. It even shows empty space for those nil dates. I just want to change the empty space to "----" or some other text.
xml nillable date
Hello,
You can use, for example, the ShowInsteadNullValues property on the DataColumn tab of the TextEditor.
Thank you.
You can use, for example, the ShowInsteadNullValues property on the DataColumn tab of the TextEditor.
Thank you.
- Attachments
-
- 1143.ShowInsteadNullValues.gif (23.06 KiB) Viewed 4045 times
xml nillable date
Hello.
Or you can write such expression:
Thank you.
You can set "Show instead null values" in Text editor.jmiller wrote:How can I test for a nil date in xml data in an expression? I have a report with dates. The dates can be nil. On the report I want to show "----" whenever a date is nil. I've tried various things but could not get it to work. Stimulsoft reads in the xml data fine. It even shows empty space for those nil dates. I just want to change the empty space to "----" or some other text.
Or you can write such expression:
Code: Select all
{(Orders["ShippedDate"] == DBNull.Value ? "---" : Orders["ShippedDate"])}
- Attachments
-
- 1144.text editor.png (63.79 KiB) Viewed 4043 times
xml nillable date
I still can't get it to work. I selected "Absent" in the drop-down and my report still shows a blank. I also tried the == DBNull.Value and that also shows a blank. Could it be because I am defining the data in code instead of the designer.
System.Data.DataSet ds = new System.Data.DataSet();
ds.ReadXmlSchema("Data\\InstallmentBill.xsd");
ds.ReadXml("Data\\SampleInstallmentBillData.xml");
ds.DataSetName = "SampleData";
Stimulsoft.Report.StiReport rpt = new Stimulsoft.Report.StiReport();
rpt.Load("Data\\InstallmentBill.mrt");
rpt.RegData(ds);
rpt.Dictionary.Synchronize();
rpt.Compile();
System.Data.DataSet ds = new System.Data.DataSet();
ds.ReadXmlSchema("Data\\InstallmentBill.xsd");
ds.ReadXml("Data\\SampleInstallmentBillData.xml");
ds.DataSetName = "SampleData";
Stimulsoft.Report.StiReport rpt = new Stimulsoft.Report.StiReport();
rpt.Load("Data\\InstallmentBill.mrt");
rpt.RegData(ds);
rpt.Dictionary.Synchronize();
rpt.Compile();
xml nillable date
I am uploading a full set of files to show my problem. Could the problem have to do with the .mrt not having any data sources defined? Here is what I did:
- Created the Visual Studio solution
- Created the sample xml and the xsd
- Created a new report mrt and loading the xml/xsd as a data source
- After I created the mrt elements I deleted the xml data source since I will be using code to define it.
- Wrote the code in my VS solution to register the xml/xsd
As you can see from the pdf provided, my 'nil' dates remain blank.
- Created the Visual Studio solution
- Created the sample xml and the xsd
- Created a new report mrt and loading the xml/xsd as a data source
- After I created the mrt elements I deleted the xml data source since I will be using code to define it.
- Wrote the code in my VS solution to register the xml/xsd
As you can see from the pdf provided, my 'nil' dates remain blank.
- Attachments
-
- 1150.SampleData2.mrt
- (8.21 KiB) Downloaded 309 times
-
- 1149.SampleData.xsd
- (790 Bytes) Downloaded 346 times
-
- 1148.SampleData.xml
- (657 Bytes) Downloaded 417 times
-
- 1147.Program.cs
- (930 Bytes) Downloaded 411 times
xml nillable date
Hello.
Also if you use expressions you can use one of next expressions:
For formatting data you can set Text Format property.
Please see attached report template.
Thank you.
If you set the ShowInsteadNullValues property on the DataColumn tab of the TextEditor and then go to Expression tab this property will not work. This problem have been added to our to-do list. Now for correcting this problem please open Text Editor in Data Column tab and press OK.jmiller wrote:I am uploading a full set of files to show my problem. Could the problem have to do with the .mrt not having any data sources defined? Here is what I did:
- Created the Visual Studio solution
- Created the sample xml and the xsd
- Created a new report mrt and loading the xml/xsd as a data source
- After I created the mrt elements I deleted the xml data source since I will be using code to define it.
- Wrote the code in my VS solution to register the xml/xsd
As you can see from the pdf provided, my 'nil' dates remain blank.
Also if you use expressions you can use one of next expressions:
Code: Select all
{IIF(DataRecord["DueDate"] == DBNull.Value,"Absent",DataRecord["DueDate"])}
Code: Select all
{DataRecord["DueDate"] == DBNull.Value ? "Absent" : DataRecord["DueDate"]}
Please see attached report template.
Thank you.
xml nillable date
I was able to get it to work with the expression code you suggested. What I was doing in my expression before was:
{IIF(DataRecord.DueDate == DBNull.Value,"Absent",DataRecord.DueDate)}
This did not work, but once I changed it to DataRecord["DueDate"] then all is fine. I'm guessing your generated property for DueDate differs from ["DueDate"].
{IIF(DataRecord.DueDate == DBNull.Value,"Absent",DataRecord.DueDate)}
This did not work, but once I changed it to DataRecord["DueDate"] then all is fine. I'm guessing your generated property for DueDate differs from ["DueDate"].
xml nillable date
Hello.
Thank you.
About the differences between DataRecord.DueDate and DataRecord["DueDate"] you can read in Stimulsoft Reports Universal User Manual in section 3.1.6.jmiller wrote:I was able to get it to work with the expression code you suggested. What I was doing in my expression before was:
{IIF(DataRecord.DueDate == DBNull.Value,"Absent",DataRecord.DueDate)}
This did not work, but once I changed it to DataRecord["DueDate"] then all is fine. I'm guessing your generated property for DueDate differs from ["DueDate"].
We are always glad to help you.It should be remembered that all the values in data sources are typed. This means that all data items
are dynamically converted to the type that is specified in the options column which helps to accelerate
the development of reports. However, if you need to get data from a column without conversion you will
need to specify the data source directly. For example, in C#:Code: Select all
{Products["ProductName"]}
Thank you.