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!

JOIN With different data type

Status
Not open for further replies.

Manuel8888

Technical User
Jun 8, 2004
1
ES
Hi

I,m trying to do a join between two tables. The field involved is a string in the first one and a number in the second one. I.E. Value Field Table 1: 1 Value Field Table 2:"0001"

Anyone know how to do it?

Please explain me in detail, I,m just starting with WebFocus.

Thanks in advance.
 
You have to convert the string to an alpha with the same 'formating' as your target field. The EDIT function MAY be able to do this for you.
 
You need to do a DEFINE based JOIN:

Something like:


JOIN MYFIELD IN TABLE1 TO ALL FIELD2 IN TABLE2 AS J1
END

DEFINE FILE TABLE1
MYFIELD/A4 WITH FIELD1 = EDIT(FIELD1);
END

TABLE FILE TABLE1
PRINT MYFIELD FIELD2
END


Look this up in a manual. Also the TO field in TABLE2 should be indexed.


 
Focman had it close. What you need is a DEFINE-Based JOIN. It looks like this:

JOIN MYFIELD [red]WITH FIELD1[/red] IN TABLE1
TO ALL FIELD2 IN TABLE2 AS J1
END

DEFINE FILE TABLE1
MYFIELD/A4 WITH FIELD1 = EDIT(FIELD1);
END

TABLE FILE TABLE1
PRINT MYFIELD FIELD2
END

The keyword WITH says that the 'from' field is a DEFINEd field, associated with the segment containing the field FIELD1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top