hi again:
thanks to all for your replies to my problem with the existing browse with the horizontal scroll bar issue. i had placed some restrictions on the browse (in the browse properties) and removing them made the scroll bar go away (seems a little odd to me but it's fixed).
i am trying to download data from a truck that has an 8 bit limit (0 to 255) in the driver_id field. this limits me to a total of 255 drivers. when the administration is entering new drivers, if there is a deleted driver (say driver 025 was deleted in a list of 075) in the drivers table i want to re-use the number 025 instead of going to number 076. the driver_id is actually a character field (in keeping with good table design practices). entering a new driver is done through a button on the main menu. i attached the following script to the driver entry form OnActivate:
dim new_id as c
dim match as n 'starting point for first available id
match = 1
tbl=table.current() 'already in the table
tbl.index_primary_put("driver_id") 'start at the lowest id
'debug(1)
tbl.fetch_first() 'start with first record
while .not.tbl.fetch_eof() 'go until there are no more records
if match!=val(tbl.driver_id) 'found an orphaned id
ui_msg_box("found orphan","") 'just a test to see if we got there
exit while
else
end if
match=match+1
tbl.fetch_next()
end while
'end of file encountered
new_id=padl(ltrim(str(match)), 3, "0")
ui_msg_box("new id is",new_id) 'just a test to see if we got there
id_update=new_id
i used OnActivate so that i could use "tbl.fetch_first()" which won't work in the enter mode. id_update is a global variable. the script finds any orphans just fine, and if there are none it assigns the next available driver_id. i placed the id_update variable on the form and it contains the correct driver_id. Then in the OnEnter script i tried the following attempts to get the variable into the field:
attempt 1
driver_id.text=id_update
driver_id.refresh()
attempt 2
driver_id=id_update
driver_id.refresh()
:driver entry:driver_id.refresh
can't seem to get the data from the variable into the form for love nor money. i tried going to the interactive tab and doing the following:
?id_update
= "005"
driver_id=id_update
?driver_id
= "005"
any suggestions?
thanks once again, seeing all the familiar names again brings back great memories!
ed
thanks to all for your replies to my problem with the existing browse with the horizontal scroll bar issue. i had placed some restrictions on the browse (in the browse properties) and removing them made the scroll bar go away (seems a little odd to me but it's fixed).
i am trying to download data from a truck that has an 8 bit limit (0 to 255) in the driver_id field. this limits me to a total of 255 drivers. when the administration is entering new drivers, if there is a deleted driver (say driver 025 was deleted in a list of 075) in the drivers table i want to re-use the number 025 instead of going to number 076. the driver_id is actually a character field (in keeping with good table design practices). entering a new driver is done through a button on the main menu. i attached the following script to the driver entry form OnActivate:
dim new_id as c
dim match as n 'starting point for first available id
match = 1
tbl=table.current() 'already in the table
tbl.index_primary_put("driver_id") 'start at the lowest id
'debug(1)
tbl.fetch_first() 'start with first record
while .not.tbl.fetch_eof() 'go until there are no more records
if match!=val(tbl.driver_id) 'found an orphaned id
ui_msg_box("found orphan","") 'just a test to see if we got there
exit while
else
end if
match=match+1
tbl.fetch_next()
end while
'end of file encountered
new_id=padl(ltrim(str(match)), 3, "0")
ui_msg_box("new id is",new_id) 'just a test to see if we got there
id_update=new_id
i used OnActivate so that i could use "tbl.fetch_first()" which won't work in the enter mode. id_update is a global variable. the script finds any orphans just fine, and if there are none it assigns the next available driver_id. i placed the id_update variable on the form and it contains the correct driver_id. Then in the OnEnter script i tried the following attempts to get the variable into the field:
attempt 1
driver_id.text=id_update
driver_id.refresh()
attempt 2
driver_id=id_update
driver_id.refresh()
:driver entry:driver_id.refresh
can't seem to get the data from the variable into the form for love nor money. i tried going to the interactive tab and doing the following:
?id_update
= "005"
driver_id=id_update
?driver_id
= "005"
any suggestions?
thanks once again, seeing all the familiar names again brings back great memories!
ed
Comment