KMoody
Member
I created a program that can receive parameter values and use dynamic queries and buffers to create a browse widget in a popup window:
I ran the program like this:
Then I received the following errors:
(Note: When I removed "item.prod-code" from my browseColumns parameter, I did not get this error.)
I was unable to find much documentation on Error 9154. What does it mean by "validation expression," and where did "can-find(PRODMSTR of ITEM)" come from?
Do widgets automatically try to validate their queries? If so, is there a way to make validation less strict?
Code:
/* *************************** Definitions ************************** */
ROUTINE-LEVEL ON ERROR UNDO, THROW.
/* ******************** Preprocessor Definitions ******************** */
DEFINE INPUT PARAMETER titleText AS CHAR.
DEFINE INPUT PARAMETER instructions AS CHAR format "X(150)".
DEFINE INPUT PARAMETER tableName AS CHAR.
DEFINE INPUT PARAMETER queryString AS CHAR.
DEFINE INPUT PARAMETER browseColumns AS CHAR.
DEFINE INPUT PARAMETER tempTableAlias AS CHAR.
DEFINE INPUT PARAMETER canSelectMultiple AS LOGICAL.
DEFINE OUTPUT PARAMETER bhTempTable AS HANDLE NO-UNDO.
DEF VAR i as integer.
DEFINE VARIABLE hBrowsePopup AS HANDLE NO-UNDO.
DEFINE VARIABLE hPopupQuery AS HANDLE NO-UNDO.
DEFINE VARIABLE hPopupBuffer AS HANDLE NO-UNDO.
DEFINE VARIABLE hBrowseColumn AS HANDLE NO-UNDO.
DEFINE VARIABLE bufferField AS HANDLE NO-UNDO.
DEFINE VARIABLE hTempTable AS HANDLE NO-UNDO.
DEFINE VARIABLE qhTempTable AS HANDLE NO-UNDO.
DEFINE VARIABLE ohQuery AS HANDLE NO-UNDO.
CREATE BUFFER hPopupBuffer FOR TABLE tableName.
CREATE QUERY hPopupQuery.
hPopupQuery:SET-BUFFERS(hPopupBuffer).
hPopupQuery:QUERY-PREPARE(queryString).
hPopupQuery:QUERY-OPEN.
CREATE TEMP-TABLE hTempTable.
hTempTable:ADD-FIELDS-FROM(hPopupBuffer,browseColumns).
hTempTable:TEMP-TABLE-PREPARE(tempTableAlias).
bhTempTable = hTempTable:DEFAULT-BUFFER-HANDLE.
DEFINE FRAME popupFrame
WITH SIZE 55 BY 45 CENTERED TITLE titleText VIEW-AS DIALOG-BOX NO-LABELS.
CREATE BROWSE hBrowsePopup
ASSIGN
FRAME = FRAME popupFrame:HANDLE
QUERY = hPopupQuery
TITLE = "Select"
COLUMN = 1
ROW = 1
WIDTH-CHARS = 50
HEIGHT-CHARS = 25
DOWN = 25
SENSITIVE = TRUE
READ-ONLY = TRUE
COLUMN-SCROLLING = TRUE
SEPARATORS = YES
MULTIPLE = canSelectMultiple
VISIBLE = FALSE
REFRESHABLE = TRUE
TRIGGERS:
END TRIGGERS.
DEF VAR aTemp AS CHAR EXTENT.
aTemp = string_util:split(browseColumns, ",").
DO i = 1 to extent(aTemp):
hBrowseColumn = hBrowsePopup:ADD-LIKE-COLUMN(aTemp[i]).
end.
ENABLE ALL WITH FRAME popupFrame.
WAIT-FOR CLOSE OF THIS-PROCEDURE.
CATCH e AS Progress.Lang.Error:
DO i = 1 TO e:NumMessages:
MESSAGE e:GetMessage(i) VIEW-AS ALERT-BOX BUTTONS OK.
END.
END CATCH.
I ran the program like this:
Code:
DEFINE var resultsTable AS HANDLE.
run show_popup.p(
"Item Selection",
"Select the item.",
"item",
"FOR EACH item NO-LOCK",
"item.part-num,item.description,item.prod-code",
"TTX",
no,
OUTPUT resultsTable).
Then I received the following errors:
Code:
Error occurred when compiling validation expression for dynamic FILL-IN PROD-CODE: can-find(PRODMSTR of ITEM) . . (9154)
Code:
Unable to read record buffer because it is empty.
(Note: When I removed "item.prod-code" from my browseColumns parameter, I did not get this error.)
I was unable to find much documentation on Error 9154. What does it mean by "validation expression," and where did "can-find(PRODMSTR of ITEM)" come from?
Do widgets automatically try to validate their queries? If so, is there a way to make validation less strict?