Can you( or How do you) delete a record in 4GL

This is an example provided from Epicor called "RunBOThru4GL.p"





&ANALYZE-SUSPEND _VERSION-NUMBER AB_v10r12

&ANALYZE-RESUME

&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure

/*------------------------------------------------------------------------

File : RunBOThru4GL.p

Purpose : This is a sample procedure to demonstrate how to run a

Vantage 8 business object on the appserver through the 4GL

without using the UI dlls or webservices.



**Note**

You will have to modify the values in Setup section based
on

your company's setup.



Syntax :



Description :



Author(s) : Raj Tapde

Created : 12-18-2005

Notes :

----------------------------------------------------------------------*/

/* This .W file was created with the Progress AppBuilder. */

/*----------------------------------------------------------------------*/



/* *************************** Definitions ************************** */

create widget-pool.



/* <Begin> Setup Section */

/*Change values here based on your company's Vantage appserver setup */

&scoped-define User_Id "manager" /* <======= Change, As this example
uses PREmployee BL, so the user id should have access and update permissions
to Fin Mgmt->Payroll->Setup->Employee screen.*/

&scoped-define PASSWORD "manager" /* <======= Change */

&scoped-define AppserverInfo (chr(1) + chr(-1)) /* Do not change */

/*Change the value of -H, which is the host name where your Vantage 8 server
software is hosted. Keep the rest unchanged

MfgSys80 is the name of the appserver. Verify it through Progress Explorer
Tool on your Vantage Server machine. You should see an appserver instance
node named MfgSys80 in your Appserver node.

-S 5162 is the port of the nameserver NS1 which should be 5162 you can again
verify it through Progress Explorer Tool.

*/

&scoped-define ConnectionParams "-AppService MfgSys80 -H localhost -S 5162"

/* <End> Setup Section */





define variable hServer as handle no-undo.

define variable hBO as handle no-undo.

define variable lReturnValue as logical no-undo.



/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME





&ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK



/* ******************** Preprocessor Definitions ******************** */



&Scoped-define PROCEDURE-TYPE Procedure

&Scoped-define DB-AWARE no







/* _UIB-PREPROCESSOR-BLOCK-END */

&ANALYZE-RESUME







/* *********************** Procedure Settings ************************ */



&ANALYZE-SUSPEND _PROCEDURE-SETTINGS

/* Settings for THIS-PROCEDURE

Type: Procedure

Allow:

Frames: 0

Add Fields to: Neither

Other Settings: CODE-ONLY

*/

&ANALYZE-RESUME _END-PROCEDURE-SETTINGS



/* ************************* Create Window ************************** */



&ANALYZE-SUSPEND _CREATE-WINDOW

/* DESIGN Window definition (used by the UIB)

CREATE WINDOW Procedure ASSIGN

HEIGHT = 15

WIDTH = 60.

/* END WINDOW DEFINITION */

*/

&ANALYZE-RESUME









&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure





/* *************************** Main Block *************************** */



/* Step 1 - Create Server handle and connect to the appserver */

create server hServer.

assign lReturnValue = hServer:connect({&ConnectionParams} ,{&User_Id},
{&Password},{&AppServerInfo}) /* Preprocessors defined in Definitions
section */.

if not lReturnValue then do:

message "Cannot Connect to the application Appserver" view-as alert-box
error buttons OK.

return error.

end.



/* Step 2 - Prepare to run your business object. */

/* You have to use the appropriate include file
bo/<<businessobjectname>>_ds.i ,

For example, if we were working with Part business object, then we would
include bo/Part_ds.i here.

This include file contains the definition of the temp tables like
ttPREmpMas

and peprocessor definitions like input-output_dataset_PREmployeeDataSet
used below in update

*/



{bo/PREmployee/PREmployee_ds.i}

define buffer altttPREmpMas for ttPREmpMas.



/* Setp 2.1 - Instantiate or start the business object persistently on the
appserver.*/

run bo/PREmployee/PREmployee.p persistent set hBO on hServer no-error.

if not valid-handle(hBO) or error-status:error then do:

/* Clean up and return error */

assign lReturnValue = hServer:DISCONNECT().

message "Could not instantiate the business object on the server."
view-as alert-box error buttons OK.

return error.

end.



/* Step 3 - Run the public method(s) inside the business object. You have to
know the signature of the methods inside the business object.

For example the GetByID method of PREmployee requires input of employee
id (character) and returns a PREmployeeDataSet dataset as output.

The preprocessor output_dataset_PREmployeeDataSet is defined in the
include file included above.

Notice GetByID is run with no-error that is to trap errors from the BL
and display it with our own error handler.

*/

run GetByID in hBO ( input "100", {&output_dataset_PREmployeeDataSet})
no-error .



if error-status:error or return-value ne "" then do:

/* Clean up and return error */

assign lReturnValue = hServer:DISCONNECT().

message return-value view-as alert-box error buttons OK.

return error.

end.



find ttPREmpMas where ttPREmpMas.EmpID = "100" no-lock no-error.

if not available ttPREmpMas then do:

/* Clean up and return error */

assign lReturnValue = hServer:DISCONNECT().

message "Employee not found" view-as alert-box error buttons OK.

return error.

end.

else do:

/* Requried for middle layer pruposes. Always duplicate the record you
want to update / delete or pass back to the appserver to maintain

If there were multiple temp-tables in PREmployeeDataSet then we would
have duplicated all of them here.

In our case PREmployeeDataSet only has one temp-table ttPREmpMas

*/

create altttPREmpMas.

buffer-copy ttPREmpMas to altttPREmpMas.

end.



/* Update the record */

assign ttPREmpMas.FirstName = "*" + ttPREmpMas.FirstName

ttPREmpMas.RowMod = "U" /* <== Important, if you update a record,
put RowMod = "U" */

.



/*assign ttPREmpMas.FirstName = replace(ttPREmpMas.FirstName,"*","").*/



/* Run another method Update to commit the changes to the server.*/

run update in hBO ({&input-output_dataset_PREmployeeDataSet}) no-error.



if error-status:error or return-value ne "" then do:

/* Clean up and return error */

assign lReturnValue = hServer:DISCONNECT().

message return-value view-as alert-box error buttons OK.

return error.

end.



/* Check and see if Updates were made. Notice the * we put in front of
FirstName field*/

for each ttPREmpMas:

display ttPREmpMas.Company format "x(5)"

ttPREmpMas.EmpID format "x(5)"

ttPREmpMas.FirstName format "x(20)"

ttPREmpMas.name format "x(30)"

.

end.

pause.





/* Step Last : Clean Up. Delete the Server handle and disconnect */

delete object hBO.

assign lReturnValue = hServer:DISCONNECT().



/* _UIB-CODE-BLOCK-END */

&ANALYZE-RESUME









From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
Dan Godfrey
Sent: Wednesday, March 31, 2010 4:57 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Can you( or How do you) delete a record in 4GL





Can you give an example of how to use an adapter in a BPM.

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]
I want to delete a record from UD08 table when Packing slips get invoiced. Does anyone know how to do this in 4Gl or ANY other way of doing this?
Well, if you get the updated Progress license key from your CAM, you will be able issue a DELETE (or CREATE) statement from a BPM 4GL action.

-bws

--
Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix / Picometrix
    bspolarich@... ~ 734-864-5618 ~ www.advancedphotonix.com


-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of dgodfrey_amc
Sent: Wednesday, March 31, 2010 2:40 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Can you( or How do you) delete a record in 4GL

I want to delete a record from UD08 table when Packing slips get invoiced. Does anyone know how to do this in 4Gl or ANY other way of doing this?



------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder and Crystal Reports and other 'goodies', please goto: http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto: http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto: http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
This can be done using the Adapters/Business objects



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
dgodfrey_amc
Sent: Wednesday, March 31, 2010 2:40 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Can you( or How do you) delete a record in 4GL





I want to delete a record from UD08 table when Packing slips get invoiced.
Does anyone know how to do this in 4Gl or ANY other way of doing this?





[Non-text portions of this message have been removed]
You can call the BO/Adapters through BPM's if you go into the advanced
options (in addition to customizations)



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
dgodfrey_amc
Sent: Wednesday, March 31, 2010 2:40 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Can you( or How do you) delete a record in 4GL





I want to delete a record from UD08 table when Packing slips get invoiced.
Does anyone know how to do this in 4Gl or ANY other way of doing this?





[Non-text portions of this message have been removed]
Can you give an example of how to use an adapter in a BPM.


[Non-text portions of this message have been removed]