Russian Wyatt 2 Posted October 20, 2022 Share Posted October 20, 2022 I have a variable (CID) that reads from table a and assigns CID the value from a field (FNum) in table a. and then when I get to table b I want to create a custom field and write the value of CID into table b. What I end up with is not the value of the field from table a, but the name of the field itself (FNum). I'm missing something obvious.-SET &CID ='Tacos';DEFINE FILE mini1-SET &CID = IF FNum EQ ' ' THEN '99-999999' ELSE FNum;ENDTABLE FILE mini1SUM FNum WHERE RECORDLIMIT IS 1ON TABLE SET BYDISPLAY ONEND-RUNDEFINE FILE mini2 Cnum/A10V = '&CID'; UID/A100V = Last_Name || First_Name || Cnum ;ENDTABLE FILE mini2PRINT UID Last_Name First_Name ON TABLE SET BYDISPLAY ONEND-RUNif the data in mini1 is 44-444444 and from mini2 is: Last_name: Smith, First_name: John then my output looks like this: Link to comment Share on other sites More sharing options...
Solution David Beagan Posted October 20, 2022 Solution Share Posted October 20, 2022 DEFINE and -SET don't work together like that. You want to use -READFILE to get the value into a variable. Like this:TABLE FILE mini1 SUM FNum AS 'CID' WHERE RECORDLIMIT IS 1 ON TABLE SET ASNAME ON ON TABLE HOLD AS FNUMHOLD END-RUN-SET &CID = 'Tacos';-READFILE FNUMHOLDThen you can continue on with your TABLE FILE MINI2. The line ON TABLE SET ASNAME ON causes the -READFILE to read into a variable called &CID instead of the default of using the fieldname which would read into a variable called &FNum. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now