Skip to Content

Storing values

Feb 08, 2017 at 02:19 PM


avatar image

I have a sub-report that I am using to filter out serial number. When the report comes back and showing multi values here I want to store that previous value, in this case it would be the date value I am interested in.

For Example:

Quality Date Serial Number

123 01/01/2017 10:10:00PM 12345

80 20/01/2017 08:00:00AM 12345

0 31/01/2017 06:50:23PM 12345

I want to store the date in the second line (one previous from the 0 quality). Also I want only to store the date ( I am using this function: totext({fielddate.table}, "MM/dd/yyyy") I know how to store this value to be a Share StringVar in my Formula workshop. I just don't know how to store this value date as 20/01/2017.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Brian Dong Feb 08, 2017 at 07:49 PM

Hi Gerald,

If you've already been able to get the correct record then to extract the Date portion, use the Split function to convert the string to an array. Have the space as the delimiter and as long as the date is always going to be the second element it should work.

StringVar x := "80 20/01/2017 08:00:00AM 12345"; 
Split (x, " ")[2]; 

So I put your string into a variable called x. Using x as the input string and " " as the delimiter, I used Split to return the second element in the array which is the date. If you want, you can use the CDate to convert it to a date type. Something like:

StringVar x := "80 20/01/2017 08:00:00AM 12345"; 
If isDate (Split (x, " ")[2]) Then 
   CDate ((Split (x, " ")[2}]) 
Else Date (0, 0, 0); 

So it checks to see if the element is a date or not. If it is then it converts the string to a date. If it's not a date then it returns a NULL date.

Hope this helps,


10 |10000 characters needed characters left characters exceeded
Abhilash Kumar
Feb 09, 2017 at 08:14 AM

Hi Gerald,

Assuming these are 'separate' columns, you'd need to do something like this:

1. Create a formula with this code and place it on the same section as the other columns:

shared stringvar dd;
if {Quality} = 0 then
dd := totext(previous({Date field}), "dd/MM/yyyy");

2. Create another formula with this code to display that previous date - I hope you wish to use this in the Main report:

shared stringvar dd;

Make sure this formula on the Main Report is in a section 'below' the section that holds the Subreport.


10 |10000 characters needed characters left characters exceeded