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

1 to many relationship question

Status
Not open for further replies.

huntnut

Technical User
Dec 17, 2002
2
US
Question - Is there a way to show a 1 to many relationship? I've done a 1 var to 1 result thing and it's really turning into a pain to keep straightened out.

My current logic statement is set up like the following

IF PLAN = 'A' THEN
DO
COMPANY = 'ABC COMPANY'
ADDR1 = '123 TEST'
ADDR2 = 'ANYTOWN, MI '
STATE = 'MI'
ZIP = '12345'
END
ELSE NOP

IF PLAN = 'B' THEN
DO
COMPANY = 'ABC COMPANY'
ADDR1 = '123 TEST'
ADDR2 = 'ANYTOWN, MI '
STATE = 'MI'
ZIP = '12345'
END
ELSE NOP

Thanks in advance,
Hunt
 
I am not fully sure what it is you are asking for but ....

Couldn't you use a SELECT with WHEN to combine the cases?

ie

SELECT
WHEN plan = "A" | plan = "B" THEN DO
COMPANY = 'ABC COMPANY'
ADDR1 = '123 TEST'
ADDR2 = 'ANYTOWN, MI '
STATE = 'MI'
ZIP = '12345'
END
OTHERWISE NOOP
END /* End select */


 
Code:
company. = '?'
company.A = "ABC Co."
company.B = "ABC Co."
company.C = "Clarion Corp."
....
if company.plan = '?' then /* unknown */
I would init all the stem arrays and then load them by reading and parsing an external file rather than by explicit assignment as shown above.

Code:
parse var line.i code 4 company.code 22,
                 addr1.code 35  addr2.code 47,
                 state.code 50 zip.code 55
 
try this.

plan = inp(&h3da)

'i have nothing against inkey. just that inp(&h3da) works better
loop until plain <> &quot;&quot;
select case plan


case is = &quot;a&quot; or &quot;b&quot; or &quot;whatever&quot;
do
COMPANY = 'ABC COMPANY'
ADDR1 = '123 TEST'
ADDR2 = 'ANYTOWN, MI '
STATE = 'MI'
ZIP = '12345'

loop




hope this helps!! Happy Coding!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top