Bob wrote:
> I'm trying figure out how run .p code from the command line to update
> the database, but I'm not having any luck. This is an example thet
> we're using as a test:
>
> I get an error message "db/trg/customer/WRITE.p Shared variable CUR-
> COMP has not been created. (392)"
I've only dabbled in the most simple Progress code, and at this point, even that is rusty. But, the problem is the Vantage code uses a bunch of global variables that get initialized when you start the client session. Code in the DB triggers uses them, and needs to have the proper values in them.
I'm pasting in an include file that Mike Podlin provided several years ago. If you include the CUR-COMP declaration in your code, and run it from the command editor window inside Vantage, it will inherit the values of the globals and the triggers should work. This is from probably circa Vantage 4.x, but it's the kind of stuff that shouldn't get changed too often so hopefuly it's still valid.
There's also some code that will disable the triggers, but I forget what it is; and it's not really a good idea anyway. Could corrupt data.
-Wayne
/*
Several Known Global Variables for Vantage
The following is a list of Global Variables used when developing applications
with Provision that write or change data in the database. You may not need all
of them and there may also be others I do not know about, but I have posted
what I have so far. You'll need to include them into the Definitions section
of you application to eliminate the undefined global variable error message:
*/
def new shared variable PROverrideCode as character format "x(16)" no-undo.
/**** GLOBAL PREPROCESOR DEFS ****/
&GLOBAL-DEFINE APPL-NAME Vantage
&GLOBAL-DEFINE APPL-HELPFILE "help/vantage.mvb":U
&GLOBAL-DEFINE APPL-HELPVIEWER "help/mviewer2.exe":U
&GLOBAL-DEFINE APPL-SPELLINGDICTIONARY "spell\american.vtd":U
&GLOBAL-DEFINE MAX-APCHKTRN 27
&GLOBAL-DEFINE DAYZERO 10/30/1953
/**** GLOBAL VANTAGE PARAMETERS ****/
&GLOBAL-DEFINE LoginKeyword "Login="
&GLOBAL-DEFINE LanguageKeyword "Language="
/**** GLOBAL SHARED VARIABLES ****/
define {1} shared var CUR-COMP as Character format "x(8)" no-undo.
define {1} shared var DCD-USERID like UserFile.DcdUserID no-undo.
define {1} shared var DCD-HELPFILENAME as character no-undo.
define {1} shared var DCD-SPELLINGFILENAME as character no-undo.
{lib/praccdef.i {1}} /* defines PR-ACCESS */
/* OPTIONAL PURCHASED MODULES FLAGS - SET BY SetModAccessFlags(mainmenu.w)*/
/* ADD VAR REFERENCE OF ANY NEW MODULES IN MAINMENU.W & CVSU0001.W */
define {1} shared var DCD-AP as logical initial FALSE.
define {1} shared var DCD-AR as logical initial FALSE.
define {1} shared var DCD-AV as logical initial FALSE.
define {1} shared var DCD-BM as logical initial FALSE.
define {1} shared var DCD-CM as logical initial FALSE.
define {1} shared var DCD-DE as logical initial FALSE.
define {1} shared var DCD-DM as logical initial FALSE.
define {1} shared var DCD-EQ as logical initial FALSE.
define {1} shared var DCD-ES as logical initial FALSE.
define {1} shared var DCD-ED as logical initial FALSE.
define {1} shared var DCD-GL as logical initial FALSE.
define {1} shared var DCD-IM as logical initial FALSE.
define {1} shared var DCD-JC as logical initial FALSE.
define {1} shared var DCD-MR as logical initial FALSE.
define {1} shared var DCD-OM as logical initial FALSE.
define {1} shared var DCD-PC as logical initial FALSE.
define {1} shared var DCD-PM as logical initial FALSE.
define {1} shared var DCD-PR as logical initial FALSE.
define {1} shared var DCD-RM as logical initial FALSE.
define {1} shared var DCD-RQ as logical initial FALSE.
define {1} shared var DCD-SR as logical initial FALSE.
define {1} shared var DCD-SV as logical initial FALSE.
/* SYSTEM DEFAULTS - SET BY lib/setcomp.p */
define {1} shared var CUR-COMP-NAME as character format "x(30)" no-undo.
define {1} shared var DEF-UM like Part.IUM no-undo. /* Default Unit of Measure */
define {1} shared var VantageMenuHandle AS WIDGET-HANDLE NO-UNDO.
/**** GLOBAL CONSTANTS ****/
def var IN-USE-CHAR as character format "x(2)" no-undo init "» ". /* ALT-0187, System Font */
def var LIST-DELIM as character format "x" no-undo init "~~".
def var SUBLIST-DELIM as character format "x" no-undo init "`".
def var PIXELS-TO-INCHES as decimal no-undo init 0.0138.
/* TEMPORARY WORK VARIABLES */
def var TempLog as logical no-undo.
def var TempHandle as widget-handle no-undo.