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

CR X

Status
Not open for further replies.

lhr28

Programmer
Feb 7, 2012
4
CA
HI,
I am new to CR-X. In the Report Header I am getting 'Employee Name' from MSSQL.Database. It shows Lastname first. I need to show First Name and then Last Name. In other words, I need to revers the order from XY to YX.
Any suggestion where / how can I handle it?

Thanks
 
Please show an example of how the field is currently displayed.

If it appears like this:

LastName, FirstName

...then you could use a formula like this:

stringvar x := {table.employname};
stringvar array y := split(x,", ");
y[2]+" "+y[1]

-LB
 
Ibass ,
Thanks for your reply.I need to understand the formula a little more.

The name appears like this: Johnson Peter (where Johnson is last name). There is no coma.

I think your formula will work,
1) Do I place this formula in String Display or Object Name?

2) In {Table.Employname} what are you refering to? Is it:

Table= Table Name in Dbase,?
Employname = Last Name?

Please explain.
Thanks
 
lhr28, you're a programmer, you need to work out most of it for yourself.

I assume that lbasss formula would go in a formula field, which you can then display. Also the software should list the database names for you, allowing you to click on them to add them.

Also you may have problems if there is more than one forename, but there's a command called Ulist that tells you how many fragments a particular Split produced.

Also while it's good to show your Crystal version, the subject line should summarise what the question is about.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
Madawc, I am new to this field (programing). Plus you are not very encouraging. My question was to Ibass, you could answer question instead of discouraging me.
 
Create this in the field explorer->formula->new and use it instead of the database field {table.employeename}.

stringvar x := {table.employeename};
stringvar array y := split(x," ");
y[2]+" "+y[1]

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top