Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting date from string and passing it in subreport 1

Status
Not open for further replies.

crystaldev1

Programmer
Nov 6, 2003
232
US
Hello, I'm using CR 11 and Sql Server 2008. I have a formula that saves a user parameter which is how this application saves user parameter. I need to extract a date field from this string and pass it into a subreport to use the same date range. This string will look like this:

<|> 05/31/2011 05:00 PM Local (GMT-8)

I just need to extract the date field and pass it in the subreport to select the date range. Thanks.

 
Is the field in the subreport a date datatype? If so, create a formula like this and use it as a link to the subreport date field:

date(split({@string}," ")[2])

You can go into the subreport selection formula (report->selection formula->record) and adjust the resulting formula as necessary.

-LB
 
This is perfect except that the string does not contain space between > and 05. So the string is "<|>05/31/2011 05:00 PM Local". Should I just use the Right function to extract the 10 characters?
 
How would I extract everything after the last ">"?

For example, I would like to extract AB123 from this string. But this value can be any number of characters:


<|>05/31/2011 05:00 PM Local(GMT-8)<|>AB123


Thanks.
 
stringvar array y := split({table.field},"<|>");
y[ubound(y)]

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top