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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking two fields with different naming conventions

Status
Not open for further replies.

jherold1

MIS
Apr 21, 2009
8
US
Hi all,

I have a solution that is working in Crystal, but when I upload it to BOE schedule it I get an Array error, that the subcript has to be between 1 and the size of the array.

What I have is a report pulling a name from one source and comparing it to the name of another source to get information from both.

In the first source the name is in this format "John Doe"
In the second source it is in this format "Doe, John"

So what I did was create this formula:

stringVar array RescName := Split({V_ACTL_CAN.RSRC_NM},",");
Trim(RescName[2] & " " & RescName[1])

Basically, this splits "Doe, John" into "John Doe"

I then use the result as a selection filter on my subreport. Any clue why I am getting this error?

Crystal Reports XII, one oracle and one SQL database (ughh...)

Thanks!
 
Hi,
Does the published report use the same user/pass/database combination as the CR client/server version?

It seems like the V_ACTL_CAN.RSRC_NM} field is returning a NULL or Blank...

Try placing the field in the report's detail section and run it from the CMC to see if data is returned ( Comment out the formula so the error does not prevent the report from running)




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thank you for your response!

Yes the user/pass combinations are identical.

I did try what you suggest, and for most it returns the expected value, however, for resources with no hours data it pulls a blank. This is what I figured as well... it is trying to split a blank value and gives an error... but why would it work on my client and not on the published application?

On the client app it just ignores the blank and returns nothing, on the published it errors. Is there some sort of check I could write in to check for a blank?

I tried If isnull(V_ACTL_CAN.RSRC_NM) then "No data"
else
stringVar array RescName := Split({V_ACTL_CAN.RSRC_NM},",");
Trim(RescName[2] & " " & RescName[1])

but it wants both to be arrays or neither.

Suggestions appreciated!
 
I bet you have some with no comma, which means there is no element 2. Try this:

If isnull({V_ACTL_CAN.RSRC_NM}) then "No data"
else
stringVar array RescName := Split({V_ACTL_CAN.RSRC_NM},",");
if Count (RescName) > 1
then Trim(RescName[2] & " " & RescName[1])
else {V_ACTL_CAN.RSRC_NM}

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top