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

Inserting into an array

Status
Not open for further replies.

ellehcsim

Programmer
Dec 9, 2003
16
0
0
PH
i have this code...

select * from cur_hold_code into array ar_holdcode

thisform.cbohold_code.clear
thisform.cbohold_code.rowsourcetype = 5
thisform.cbohold_code.rowsource = "ar_holdcode"

is there a way to insert another item into the combo box?

Please help. Tnx!
 
Use the AINS() function.

dimx = ALEN(ar_holdcode) + 1
DIMENSION ar_holdcode(dimx) && AINS truncates last element
=AINS(ar_holdcode, 7) && position of new element
ar_holdcode(7) = 'new element'

thisform.cbohold_code.clear
thisform.cbohold_code.rowsourcetype = 5
thisform.cbohold_code.rowsource = "ar_holdcode"

Jim
 
first of all, thanks.! But it didn't worked, sorry. it got all the data messed up in the combo box. :(

this code..

select * from cur_hold_code into array ar_holdcode

thisform.cbohold_code.clear
thisform.cbohold_code.rowsourcetype = 5
thisform.cbohold_code.rowsource = "ar_holdcode"


return this data into the combo box...

PDA | Past Due Accounts
RTN | Returned Checks

all i wanted is to insert another item so that when a user drops down the combo box ..

PDA | Past Due Accounts
RTN | Returned Checks
NONE | No Hold Code

but of course the number of rows and columns depends on the cur_hold_code table.

Please help..
thanks a lot!!!








 
Since it is a multi column array you need to add one more parameter to the ALEN() function to determine number of rows:

dimx = ALEN(ar_holdcode,1) + 1


Notice the ",1"

To determine the number of columns, use ",2"

lnRows = ALEN(ar_holdcode,2)
Now initialize the array.

FOR lni = 1 to lnRows
ar_holdcode[dimx,lni] = ""
ENDFOR






Jim Osieczonek
Delta Business Group, LLC
 
An alternative that I find easier is to use a UNION in SQL to put the extra value in the array. An example from my current app is:

SELECT MAX("--None--") As PayMethod ;
UNION ALL
SELECT Paymethod From PayTypes ;
ORDER BY 1 ;
INTO ARRAY laPayMethod

The MAX is a kludge so as I only get one entry.

Geoff Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top