Need help parsing a string and adding months to the date
Posted: Sun Oct 13, 2019 12:10 am
Hello,
I hope this is the correct forum. Our developers use Stimulsoft for our reporting solution within the app. When I customize a template (using the Report Designer), I'm trying solve an issue and keep running into various issues. We have a string of text in one of the fields (Status) in the DataSource. It will be like one of the following strings:
10/01/2019
● 04/17/2020
The first string indicates something was completed this day. The second string indicates something has not yet been completed and is due on that date. What I want to end up with is the date only to which I can compare and see if that due date is within the next 3 months. So, I want to parse the date out, add 3 months to it and compare that to the current date and then highlight the data element with font and other formatting if it is within 3 months to the due date.
If the string starts with a bullet character, I need to strip it off and leave just the date. This I've been able to accomplish with an IIF and Substring functions if I put it in the Expression on the field in the Data band. That expression is: {IIF(Left(DataSource.Status,1) != "●", DataSource.Status,Substring(DataSource.Status,2,10))}
However, I cannot convert this to a date value to which I can then add 3 months to the date and then do a Condition format on it.
I tried putting that IIF expression in a user-defined variable that I've added in the report but it does not seem to work (nothing prints/displays in the field).
Do you have any suggestions? I have scoured the forums, a number of websites (including Stack Overflow) and cannot seem to get this figured out. I'd like to be able to do this without having our development staff have to modify the DataSource.
Thanks in advance!
I hope this is the correct forum. Our developers use Stimulsoft for our reporting solution within the app. When I customize a template (using the Report Designer), I'm trying solve an issue and keep running into various issues. We have a string of text in one of the fields (Status) in the DataSource. It will be like one of the following strings:
10/01/2019
● 04/17/2020
The first string indicates something was completed this day. The second string indicates something has not yet been completed and is due on that date. What I want to end up with is the date only to which I can compare and see if that due date is within the next 3 months. So, I want to parse the date out, add 3 months to it and compare that to the current date and then highlight the data element with font and other formatting if it is within 3 months to the due date.
If the string starts with a bullet character, I need to strip it off and leave just the date. This I've been able to accomplish with an IIF and Substring functions if I put it in the Expression on the field in the Data band. That expression is: {IIF(Left(DataSource.Status,1) != "●", DataSource.Status,Substring(DataSource.Status,2,10))}
However, I cannot convert this to a date value to which I can then add 3 months to the date and then do a Condition format on it.
I tried putting that IIF expression in a user-defined variable that I've added in the report but it does not seem to work (nothing prints/displays in the field).
Do you have any suggestions? I have scoured the forums, a number of websites (including Stack Overflow) and cannot seem to get this figured out. I'd like to be able to do this without having our development staff have to modify the DataSource.
Thanks in advance!