• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

Clearing work files in UBE's

Euroboy

Active Member
Clearing work files in UBE\'s

Hi All,

Can anyone tell me how I can clear the existing data in an existing (work) file/table. I am populating a work file as part of a report but the file needs to be empty / cleared prior to me poplulating it.

WHich is the best way ... or is there only one way to di it ... or cant it be done (i dont believe the latter!!).

Thanks
 

got_to_love_jde

Reputable Poster
Re: Clearing work files in UBE\'s

hi euroboy,
there are at least two ways to do this. you can use event rules to read, after selecting all,and then delete records in a loop. and i remember someone mentioning a business function B8000002 that will also do this. i have not used the business function but have used the event rule option before.
whichever option you use it should be done in the init section of your ube.
dave


NT 4.0 SP5, SQL 7.0, One World B7321 SP12.4
 

pcaenaro

Well Known Member
Re: Clearing work files in UBE\'s

Hi Euroboy,

Use B8000002 "DeleteAllRowsFromTable".
This function accepts the table name as a parameter and will, as the name
says, delete all records

Cheers

Philippe
----- Original Message -----
From: "euroboy" <sabirpatankar@excite.co.uk>
To: <jdeowdevml@jdelist.com>
Sent: Monday, December 11, 2000 7:07 AM
Subject: Clearing work files in UBE's ~~0:2419


> Hi All,
>
> Can anyone tell me how I can clear the existing data in an existing (work)
file/table. I am populating a work file as part of a report but the file
needs to be empty / cleared prior to me poplulating it.
>
> WHich is the best way ... or is there only one way to di it ... or cant it
be done (i dont believe the latter!!).
>
> Thanks
>
>
>
>
> --------------------------
> Visit the forum to view this thread at:
>
http://198.144.193.139/cgi-bin/wwwthreads/showflat.pl?Cat=&Board=OWDEV&Numbe
r=2419
> *************************************************************
> This is the JDEList One World / XE Developers Mailing List.
> Archives and information on how to SUBSCRIBE, and
> UNSUBSCRIBE can be found at http://www.JDELIST.com
> *************************************************************
 

Zoltan_Gyimesi

Legendary Poster
Re: Clearing work files in UBE\'s

Hi Euroboy,
If you don't want to clear all records, only a part of them then you can delete them with a single delete statement if they can be selected based on a partial key as leading field(s) of an index.

If your work table resides in a common datasource (e.g. Business data) then you have to ensure:
1.) Only one copy of your UBE can run in the same time.
...OR...
2.) Different copies of your UBE running in the same time use different sets of records in your work table.

Gennerally when I use worktable, then I want:
* to make possible to run it on the server, so the worktable have to be reside in a shared datasource (e.g System)
* to make possible the concurrent running of the UBE
I include the USER (User ID) and MKEY (Machine Key) fields in the table and use them as the first two field in each index.
With this method each running copy of the UBE can identify their own set of records and handle separately with the other.
I delete the records based on a partial key selection (USER, MKEY) before and after my main process.
Further, I include these fields in the Processing options too, making possible to overide them, using PO values instead of the system values. It makes possible to start more copy in the same time by the same user from the same workstation.
At last, I make an interactive application to list and purge the potential junk records from the worktable.
Zoltán




B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 

vbojan

Well Known Member
Re: Clearing work files in UBE\'s

Hi euroboy,

Table IO, Delete, in “Do section” of report header ER.

Regards,
Bojan.
 

Euroboy

Active Member
Re: Clearing work files in UBE\'s

Thanks guys for all your answers. I did know I could use the delete IO statement ... but when you've got thousands of records in the file I didnt want to that as its not CPU effective.

Zoltan, if u are reading this, then please answer this. Yes I did like your use of a key identifier .. but then how are you deleting / clearing the set of records belonging to a particular key??? Using table IO delete statement in a loop?? I suppose thats the only way in this case.
 
Re: Clearing work files in UBE\'s

If you are on AS/400 and running the UBE on server, you can create a business function that simply calls the system command CLRPFM to clear out the file. Just make sure the file is not being used elsewhere.

Muneeb Ahmad
Oracular Systems & Software Inc.

On Tue, 12 December 2000, euroboy wrote:

>
> Thanks guys for all your answers. I did know I could use the delete IO statement ... but when you've got thousands of records in the file I didnt want to that as its not CPU effective.
>
> Zoltan, if u are reading this, then please answer this. Yes I did like your use of a key identifier .. but then how are you deleting / clearing the set of records belonging to a particular key??? Using table IO delete statement in a loop?? I suppose thats the only way in this case.
>
>
> --------------------------
> Visit the forum to view this thread at:
> http://198.144.193.139/cgi-bin/wwwthreads/showflat.pl?Cat=&Board=OWDEV&Number=2475
> *************************************************************
> This is the JDEList One World / XE Developers Mailing List.
> Archives and information on how to SUBSCRIBE, and
> UNSUBSCRIBE can be found at http://www.JDELIST.com
> *************************************************************


Find the best deals on the web at AltaVista Shopping!
http://www.shopping.altavista.com
 

Zoltan_Gyimesi

Legendary Poster
Re: Clearing work files in UBE\'s

Hi Euroboy,
Here is some explanation.

1.) I have a worktable F5501005 where I use MKEY and USER to identify a set of record.
2.) All indecies of the table begins with this two field.
3.) The primary unique key is: MKEY, USER, TXTI
4.) I delete the record set before and after my main process with a single delete statement based on a partial key selection using my primary unique key (MKEY, USER, TXTI)

F5501005.Delete
........VA rpt_MKEY_KeyForWorkFile = TK Machine Key
........VA rpt_USER_KeyForWorkFile = TK User ID

It is "partial" because I use only the first two field of the index for the selection criteria of the Delete Table I/O.
This method could work correctly only when you use the leading part of an index for selection critereia of delete.

I haven't real experiences about the performance of this method because in live it affects some thousand records and it was fast always without any performance problem.
I suppose, it has to work much faster then deleting record in a While loop.

Please, share your experiences about the performance if you tried this method, I would be very thanksful.

P.S.: I have tried to copy here my full table definitions and a larger part from my Event Rules as an example but it lost its tabulated format and got to almost unreadable.

If you want, I put it here in a new post in its hard readable format and/or send you personaly in an e-mail as attachments.
Good luck,
Zoltán




B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 

WSchmatz

Active Member
Re: Clearing work files in UBE\'s

--part1_f4.5805fc4.27699793_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

I usually put in a key date,time and user in the work file and us a table I/O
Delete to remove the data at the end of the UBE. This way multimple copies
of the UBE can run at the same time.

If you are using table conversion you can also use the option to clear the
output table.

Good Luck

Bill Schmatz
Business Systems Solutions, Inc

--part1_f4.5805fc4.27699793_boundary
Content-Type: text/html; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

<HTML><FONT FACE=arial,helvetica><FONT SIZE=2>I usually put in a key date,time and user in the work file and us a table I/O
Delete to remove the data at the end of the UBE. This way multimple copies
of the UBE can run at the same time.



If you are using table conversion you can also use the option to clear the
output table.



Good Luck



Bill Schmatz

Business Systems Solutions, Inc</FONT></HTML>

--part1_f4.5805fc4.27699793_boundary--



Bill Schmatz
Business Systems Solutions, Inc
 

WSchmatz

Active Member
Re: Clearing work files in UBE\'s

Just for calarification. The Table IO Delete function deletes all records meeting the key or partial key. There is no reason to use a while loop. As for performance I have not had any experience with thousands of records but it should not be a problem.


Bill Schmatz
Business Systems Solutions, Inc
 
Top