eric.dizon
11th December 2013, 22:33
I have a multi-occ form that I have like 1000 records which I am trying to write the contents in a csv file. When i use the following code
for i = 1 to filled.occ | fattr.occurnr
do.occ.without.update(i, insert_contact)
next i
no matter if i used filled.occ or fattr.occunr I can only get the records visible in the screen which is like 41 records. How can I export all the 1000 records visible or not?
mark_h
12th December 2013, 16:00
What I typically do in 4C4 is write a routine to find all the records and process the records. So what I typically do is give them two options (1) Process the selected records which does what you posted. Or option (2) process all the records. Then I write a routined to do a select to get all the records and then process them all one at a time. Now there is a possibility something better exists in LN. PS you don't need to worry about the extra stuff in the sample below - just shows how I do something like this.
Here is a sample from 4c4:
|******************************************************************************
| This is what the Process Order button runs
|******************************************************************************
choice.user.0:
before.choice:
cmd.value = 0
on.choice:
execute(update.db)
if(not marked) then
if ask.enum("tdapi0002", tcyesno.no) = tcyesno.yes then
spool.device = ""
process.pick()
endif
select_second()
execute(find.data)
else
message("Individual Items are selected, please use the Selected Items Button.")
choice.again()
endif
|******************************************************************************
| This is what the Cancel button runs
|******************************************************************************
choice.user.1:
before.choice:
cmd.value = 0
on.choice:
execute(end.program)
|******************************************************************************
| This is what the Process Selected item button runs
|******************************************************************************
choice.user.2:
before.choice:
cmd.value = 0
on.choice:
if(not marked) then
message("No records selected.")
choice.again()
else
spool.device = ""
process_selected_items()
select_second()
execute(find.data)
endif
| Part of process selected items
function process_selected_items()
{
| Hold the 4 fields that we can do the release by.
hold.orno = tdapi401.orno
hold.opno = tdapi401.opno | 20080811
hold.cwar = tdapi401.cwar
hold.runn = tdapi401.runn
hold.occu = 0
if pdno.status = "Onhold" then
message("Order on hold, release not possible.")
choice.again()
endif
for i = 1 to filled.occ
if(mark.table(i)) then
hold.occu = hold.occu + 1
do.occ(i,store_item)
endif
endfor
| Part of process the pick routine
function process.pick()
{
domain tcitem lockset
domain tcmcs.long cnt.dates
| Check production order status
hold.orno = tdapi401.orno
hold.cwar = tdapi401.cwar
hold.opno = tdapi401.opno | 20080811.st Add operation
hold.runn = tdapi401.runn
if pdno.status = "Onhold" then
message("Order on hold, release not possible.")
choice.again()
endif
load_tdapi401()
| Check and make sure no items are blocked for cycle count or signal code.
select tdapi401.*
from tdapi401 |for update
where tdapi401._index2 = {:hold.orno}
and tdapi401.opno = :hold.opno | 20080811 Add opno to the select
and tdapi401.runn = :hold.runn
and tdapi401.cwar = :hold.cwar
selectdo
eric.dizon
12th December 2013, 22:44
Hi Mark,
Thanks for the response. My UI would behave this way. I would show all the Contacts table (tccom140) to my user linked with their corresponding BP and Addresses. Then they can filter dynamically in the WebUI. And then what is displayed in the rows are the one I like to update all the records and export to a csv file. There is a need then to look whatever dynamic selection the user filtered in quick filter in the WebUI. I would need to look to all visible and non-visible records listed in my overview session.
JaapJD
13th December 2013, 09:36
The pattern to use here is to export the selected records to the file. You can do that with the do.selection() function.
So, the user makes the selection (also Select All is supported) and activates the export.
Note that you need to have the TIV number of the script of at least 1075 and you must also activate the Select All standard command. See Record Selection Overview in the Programmers Manual.
eric.dizon
13th December 2013, 18:27
Thanks Jaap that worked for me. You are life saver. Your recommendations are on point and usually leads to resolutions. I appreciate your help and mark_h for your timely responses.