Kathy
Bob Buford-Abba Systems wrote:
Well, I was writing in a bit of a short-hand fashion. You need to choose a table's column as the "key" you want to use in the array (e.g. EMPLID). Then when you are looking through the array for that employee's record you test for a match on EMPLID, like this...move 0 to #iCREATE-ARRAY NAME=PERSDATA SIZE=? !need to predetermine size of array FIELD=EMPLID:CHAR FIELD=MED_DATA:CHAR FIELD=ETC:CHAR FIELD=DIINFO:CHAR BEGIN-SELECTEMPLIDMED_INFOETC put &EMPLID &MED_INFO &ETC into PERSDATA(#i) EMPLID MED_INFO ETC add 1 to #iFROM PS_tableEND-SELECTBEGIN-SELECTDI.EMPLIDDI.INFO do Update-PersDataFROM PS_DENTAL_INFO DIEND-SELECTBEGIN-PROCEDURE move 0 to #loopWHILE #loop < #Limit get $EMPLID from PERSDATA(#loop) if $EMPLID = &DI.EMPLID put &DI.INFO into PERSDATA(#loop) DI_INFO break ! no need to loop any further for this EMPLID end-if END-WHILE END-PROCEDURE I hope this helps. You should get into the Help for Arrays in SQR for further info. I'm leaving shortly, so if you need further help today, maybe someone else can pick up where I left off. HTHBob-----Original Message-----This is probably a stupid questions, but how do you make a field a key in an array?
From: Kathy Mason [mailto:kmason@GIX-GLOBAL.COM]
Sent: Friday, November 05, 1999 2:29 PM
To: Multiple recipients of list SQR-USERS
Subject: Re: Updating an array
Bob Buford-Abba Systems wrote:
Kathy,
Have you considered putting a key in one of the array fields, then looping through the array to find that key. Once you've determined the element you can do numeric operations (see ARRAY-ADD, ARRAY-DIVIDE, ARRAY-MULTIPLY, and ARRAY-SUBTRACT) and you can do string operations by extracting value, operating on it and "putting" it back into the array.
HTH
Bob-----Original Message-----
From: Kathy Mason [mailto:kmason@GIX-GLOBAL.COM]
Sent: Friday, November 05, 1999 12:32 PM
To: Multiple recipients of list SQR-USERS
Subject: Updating an arrayDatabase Oracle 7
SQR Version 4
Platform HPUXI was wondering if there is a simple way to update an array.
I am working on an SQR that prints data as it is selected but writes to a file
when the id changes. I am storing dependent data in an array because one ee may
have numerous dependents.
I get their medical info and insert into an array - I need to then update array
after I get the dental info. Is that possible? I couldn't file anything
referencing this in the archives or in reference books. Perhaps I am looking
for the wrong thing.Any help would be appreciated.
Kathy