Error Service provides the following features:
The error service message and security tables are provided in pfc.db installed in the PFC directory. You can use the pipeline to create a table on your database or use the SQL below to generate the table.
- CREATE TABLE "dba"."messages"
- ("msgid" char(40) NOT NULL ,
- "msgtitle" char(255) NOT NULL ,
- "msgtext" char(255) NOT NULL ,
- "msgicon" char(12) NOT NULL ,
- "msgbutton" char(17) NOT NULL ,
- "msgdefaultbutton" integer NOT NULL ,
- "msgseverity" integer NOT NULL ,
- "msgprint" char(1) NOT NULL ,
- "msguserinput" char(1) NOT NULL
- , PRIMARY KEY ("msgid"));
- CREATE UNIQUE INDEX "messages unique (msgid)"
- ON "dba"."messages"
- ("msgid" );
The message file is in tab separated text format. The easiest way to create this file is by retrieving the data from the message table and saving it in Text (w/o headers) format. You can use the database painter or create a custom datawindow. d_definedmessages in pfcapsrv.pbl is a good starting point..
This message indicates that the error service was unable to retrieve the message from the database. Error typically happens when the service was initialized prior to the transaction being connected. Before setting the predefined source to a transaction, make sure that the transaction is initialized and connected. of_setpredefinedsource() will return -1 if the transaction is not valid or not connected. It may be a good idea to set the message source to a file until a valid database connection is established. Because the database connection is established pretty early in the application, the file does not have to have all the messages.
If you choose not to use a message repository you may still need to specify a predefined message file. As soon as the error service is enabled PFC will try to use the predefined messages. The file only needs to contain the five messages defined originally in the messages table.
Yes. One of the versions of the of_message function allows to override the predefined message title. Sometimes this version is overlooked because it was omitted from the online help. The three predefined message versions of the function are listed below:
- of_message ( string as_msgid ) returns integer
- of_message ( string as_msgid, string as_msgparms[] ) returns integer
- of_message ( string as_msgid, string as_msgparms[], string as_overridetitle ) returns integer
If the message does not have any substitution parameters an empty string array should be passed to match the function signature:
- // Display the predefined message with the window name as a title
- String ls_empty[]
- gnv_app.inv_error.of_message ("pfc_closequery_savechanges", ls_empty, This.Title)
Currently PFC message table does not support different messages for display and error log.
A solution to this problem is to display one message then turn the unattended mode on and log a different message:
- gnv_app.inv_error.of_message("display_msg")
- gnv_app.inv_error.of_setunattended(true)
- gnv_app.inv_error.of_message("log_msg")
- gnv_app.inv_error.of_setunattended(false)
This question comes up often because of a bug in 5.0.01 where the new line character is omitted from the entries to the log file. The bug is fixed in 5.0.02 but the workaround is to override of_CreateLogText() to add new line character after each error is logged.
The same method may be used to add custom information to each log entry.
Contributed by PFCGuide staff, except
where noted otherwise.
PFCGuide is sponsored by Dynamic Technology Group.
The information provided is for advice only and not to be considered a contract or a
liability against Dynamic Technology Group.
Last revised: February 15, 2004 03:58 AM.