Delete Records from Work File

MumbaiBlues

Active Member
Hi All,
I tried using the Business Function "B76C114" DeleteALLRows..It at timzz works and at times fails...I want my table to get cleared every time when it is run that is in the start of the report...as of now I'm deleting it on the bases of UserId..however worried abt the multiuser run...
I dont want to make the userid as a primary key...

Could you please suggest on this...
 
If you want to clear the file completely before each run of the report, use this combination of business functions:

(Create this variable of GENLNG type)
evt_GenericLong_GENLNG
//
// Clear the Work Table
Get Input Output Env Handles (B8000007)
UNDEFINED X szInputEnvironment
UNDEFINED X idInputEnvHandle
UNDEFINED X szOutputEnvironment
VA evt_GenericLong_GENLNG <- idOutputEnvHandle
UNDEFINED X szLoginEnvironment

Delete All Rows From Table (B8000002)
"F*****" -> szTableName
VA evt_GenericLong_GENLNG -> idOutputEnvHandle

Free Input Output Env Handles (B8000007)
UNDEFINED X szInputEnvironment
UNDEFINED X idInputEnvHandle
UNDEFINED X szOutputEnvironment
VA evt_GenericLong_GENLNG -> idOutputEnvHandle
UNDEFINED X szLoginEnvironment
//

Hope this helps.
 
Use the following business functions:
Get Input Output Env Handles (B8000007)
UNDEFINED X szInputEnvironment
UNDEFINED X idInputEnvHandle
UNDEFINED X szOutputEnvironment
VA rpt_GenericLong_GENLNG <- idOutputEnvHandle
UNDEFINED X szLoginEnvironment
Delete All Rows From Table (B8000002
"F5530001" -> szTableName
VA rpt_GenericLong_GENLNG -> idOutputEnvHandle
Free Input Output Env Handles (B8000007)
UNDEFINED X szInputEnvironment
UNDEFINED X idInputEnvHandle
UNDEFINED X szOutputEnvironment
VA rpt_GenericLong_GENLNG -> idOutputEnvHandle
UNDEFINED X szLoginEnvironment

MumbaiBlues <[email protected]> wrote:
Hi All,
I tried using the Business Function "B76C114" DeleteALLRows..It at timzz works and at times fails...I want my table to get cleared every time when it is run that is in the start of the report...as of now I'm deleting it on the bases of UserId..however worried abt the multiuser run...
I dont want to make the userid as a primary key...

Could you please suggest on this...
 
Thanks a lot....
I just have one more concern..If multiple users run the report then wont it delete the info of the first user...
 
Hi MumbaiBlues,

[ QUOTE ]
I just have one more concern..If multiple users run the report then wont it delete the info of the first user...

[/ QUOTE ]

It will.

I suppose, it is a work table, which stores data temporarily for s processing session. Am I right?

If I am right, then my usual way is to add a NextNumber or UniqueKeyID to the table, further each index of the table begins with this field.
Each session retrieves its own unique session ID at the beginning of the process, so it is possible to deal only with those records, which belongs to the session(icluding Insert, Update, Delete, Fetch).

Regards,

Zoltán
 
Hi Zoltan,

Thanks for the suggestion...
Last sip of the soup :)...shall I make the UKID as a part of my Table along with the keys which I have right now...
Or should I just add the field and populate it using the Business function X00022(Get next uniquie Key ID)....
 
GuitarMan,

Your suggestion is a perfect plug for a quick little NER... Put the three
functions in a single NER, attach the File Name we want to clear as the
DataStructure - and never have to worry about the other two steps again....

But, then - you'd require us to do it all in a single C-Function....

:)

I'm home on Fridays and one week a month - let's do lunch

(db)




--
 
Hi MumbaiBlues,

I am afraid, I don not understand your question clearly - you know, my English
frown.gif


Steps:
- add UKID to the end of your existing table
- add UKID to all indicies of the table as first key field
- re-genarate the table
- maybe you have to re-create all Business View which contains this table
- re-write all Table I/O which refers this table, using session UKID in all selection (Select, Delete, Fetch Single) and in Insert

In the session you should call X00022 (Get next uniquie Key ID) only once, at the beginning. Use this UKID value everywhere in the session.
I generally follow the following:
- Get Next UKID
- Delete with partial key selection the worktable, selecting only with UKID
- Session Logic use always the UKID, as I mentioned above
- at the session end I Delete again with partial key selection the worktable, selecting only with UKID

Hope, this helps.

Regards,

Zoltán
 
I use worktables to build temporary data cubes and deal with the multiple user issue by having the UBE run in a single-threaded queue.

Regards,
Wendell
 
Hi. I'm working in E9.1. I've done the exact same coding, but it's not working. I've done the same coding in previous releases prior to E9.1 and it worked. Has the coding change in E9.1?
 
Back
Top