on 02-08-2017 2:19 PM
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.
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.
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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,
Brian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.