Hello All,
Working on a puzzler. In an effort to speed up data entry in a browse, the data entry person could select one office for all the offices. Instead in entering each office manually they would just select one office titled �All Offices�. I would then run a script (after data entry is complete) that would convert the one office into entries for all the offices. The only thing that would be different in each record is the actual office id (child) number the date and the main id (parent) number would be the same. (In my real world application there are more fields) Below is the main concept I have been working on in XBasic, I didn�t test this code just typed cleaner code for forum. For the most part it works. If there is only one "All Office� record it works great. It deletes the �All Office� record and creates 12 new ones with the proper data in the fields, but if there is more than one �All Office� record it only copies and deletes the first one. Any ideas?
Thanks in Advance!
Sean
�Variables
Dim next_numb as n
Dim next_date as d
Dim tbl_main as p
Dim tbl_index as p
�Open table, set index,number of records, go to first record
�Table where the browse records are stored
tbl_main = table.open(�Main�)
tbl_index = tbl_main.index_primary_put("ID")
num = tbl_index.records_get()
tbl_main.fetch_first()
i = 1
while i 1 �ID number for all offices
next_office = tbl_office.office_id
tbl_main.enter_begin()
tbl_main.office = next_office
tbl_main.numb = next_numb
tbl_main.date = next_date
tbl_main.enter_end(.T.)
end if
j=j+1
tbl_office.fetch_next()
end while
tbl_office.close()
end if
i=i+1
tbl_main.fetch_next()
end while
tbl_main.close()
Working on a puzzler. In an effort to speed up data entry in a browse, the data entry person could select one office for all the offices. Instead in entering each office manually they would just select one office titled �All Offices�. I would then run a script (after data entry is complete) that would convert the one office into entries for all the offices. The only thing that would be different in each record is the actual office id (child) number the date and the main id (parent) number would be the same. (In my real world application there are more fields) Below is the main concept I have been working on in XBasic, I didn�t test this code just typed cleaner code for forum. For the most part it works. If there is only one "All Office� record it works great. It deletes the �All Office� record and creates 12 new ones with the proper data in the fields, but if there is more than one �All Office� record it only copies and deletes the first one. Any ideas?
Thanks in Advance!
Sean
�Variables
Dim next_numb as n
Dim next_date as d
Dim tbl_main as p
Dim tbl_index as p
�Open table, set index,number of records, go to first record
�Table where the browse records are stored
tbl_main = table.open(�Main�)
tbl_index = tbl_main.index_primary_put("ID")
num = tbl_index.records_get()
tbl_main.fetch_first()
i = 1
while i 1 �ID number for all offices
next_office = tbl_office.office_id
tbl_main.enter_begin()
tbl_main.office = next_office
tbl_main.numb = next_numb
tbl_main.date = next_date
tbl_main.enter_end(.T.)
end if
j=j+1
tbl_office.fetch_next()
end while
tbl_office.close()
end if
i=i+1
tbl_main.fetch_next()
end while
tbl_main.close()
Comment