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

Number to String

Status
Not open for further replies.

3dthies

Programmer
Mar 12, 2003
77
0
0
DE
I have to connect two fields from two tables.

In the first table there is a field ("GRUP" type number) which has the exact content
as the other field ("GRUP" type string) in the second table.

I cannot connect these two because there have different data types. What can I do?

Thanks
 
Either use totext() on the number field OR use tonumber() on the string field.

'J

CR8.5 / CRXI - Discovering the impossible
 
Hmm, but how can this help me? Don't I have to link the two tables together in the database expert?
 
What version of CR are you using?

You can either create a formula using the table containing the string field:

tonumber({table.Grup})

...and then add the other table in a subreport where you then link the sub to the main report by linking the marin report formula to the number field of the subreport.

Or, better yet, use a command as your datasource where you convert the field when linking in the From clause, as in:

select table1.`numbergrup`, table1.`otherfield`,{fn convert(table2.`stringgrup`,SQL_integer)}, table2.`otherfield`
from table1 inner join table2 on
table1.`numbergrup` = {fn convert(table2.`stringgrup`,SQL_integer)}

How you punctuate and what function you use for conversion will depend upon your database.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top