Naming a Dynamic ProDataSet : Openedge - openedge

I want to assign a name(in the calling Procedure) to the ProDataSet created dynamically.
example:
RUN DynamicDataSet2.p
(INPUT "Order,OrderLine,Item",
INPUT "OrderNum,LineNum,ItemNum",
INPUT "OrderNum,OrderNum",
INPUT "< 10",
OUTPUT DATASET-HANDLE hDataSet)
Can the ProDataSet returned as an output parameter(handle) be assigned a name in the UI?

The NAME attribute of a ProDataSet object handle is writeable so you can do :
RUN DynamicDataSet2.p
(INPUT "Order,OrderLine,Item",
INPUT "OrderNum,LineNum,ItemNum",
INPUT "OrderNum,OrderNum",
INPUT "< 10",
OUTPUT DATASET-HANDLE hDataSet).
hDataSet:NAME = "SomeName".

Related

How to access controls?

I have just created a window, containing a fill-in field (TestField) and a checkbox (chk_TestField):
DEFINE VARIABLE TestField AS INTEGER VIEW-AS FILL-IN.
DEFINE VARIABLE chk_TestField AS LOGICAL VIEW_AS TOGGLE-BOX.
It is very simple to change the value of the fill-in field, based on the checking of the checkbox, something like:
ON VALUE-CHANGED OF chk_TestField IN FRAME DEFAULT-FRAME
DO:
TestField = 5.
END.
However, I'm interested in changing an attribute of the Fill-in field itself, not the integer it represents (I would like to make the fill-in field read-only), how to I do this?
I've tried:
ON VALUE-CHANGED OF chk_TestField IN FRAME DEFAULT-FRAME
DO:
TestField.Read-Only = NOT(chk_TestField).
END.
This, obviously, does not work.
ASSIGN TestField:READ-ONLY IN FRAME {&FRAME-NAME} = TRUE.
or
ASSIGN Table.TestField:READ-ONLY IN FRAME {&FRAME-NAME} = TRUE.

How to Change Appearance of Text in ChUI Editor Widget

I'm using an editor widget to display a longchar value read from a text file. OpenEdge 11.5 ChUI on Linux.
The logic is similar to the following:
def var mytext as longchar
init "Sample Text. Sample Text. Sample Text.".
form mytext view-as editor large inner-chars 30 inner-lines 15
scrollbar-horizontal scrollbar-vertical
with frame frame1 no-labels no-box.
view frame frame1.
display mytext with frame frame1.
mytext:read-only = yes.
enable mytext with frame frame1.
wait-for end-error of mytext.
When the editor is displayed, the text in the editor widget is "highlighted" (i.e., shown in reverse video). (See screenshot below.)
Is there a way to display the text in the editor widget so that it is not "highlighted"?
I usually do something like this:
/* textedit.p
*
* a file viewer
*
*/
define variable fileName as character no-undo format "x(30)".
define variable fileBody as longchar no-undo.
fileName = "textedit.p".
file-info:file-name = fileName.
if file-info:full-pathname = ? then
do:
message "no such file:" fileName.
pause.
quit.
end.
copy-lob from file file-info:full-pathname to fileBody.
display
fileBody view-as editor inner-chars 160 inner-lines 52 large no-word-wrap
with
no-box
no-labels
color display normal prompt normal /* this changes the coloring */
.
pause.
https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvref/color-phrase.html
You can also fiddle with frame and widget attributes if you prefer that sort of thing.

PDSOE Custom Toolbar option "Send file name of the current selection" with multi select?

I am playing around with adding some custom tools to my PSDOE. I have added a new toolbar entry to experiment with the OpenEdge Customization Options. I have checked the option "Send file name of the current selection" and modified the procedure it is calling to have a single input parameter to get the selected file name when it is clicked.
This works great on a single select. When I start messing around with a multi select of files in the project explorer, it only passes the last one selected into the procedure file.
ROUTINE-LEVEL on error undo, throw.
define input parameter ip_cParameters as character no-undo.
{adecomm/oeideservice.i}
/* *************************** Main Block *************************** */
define variable cParamters as character no-undo.
define variable cFileName as character no-undo.
define variable cProjectName as character no-undo.
define variable cProjectDisplayName as character no-undo.
assign
cParamters = entry( 1, ip_cParameters, chr(3) )
cFileName = entry( 2, ip_cParameters, chr(3) )
cProjectName = getProjectName()
cProjectDisplayName = getProjectDisplayName().
message
"Parameters: " cParamters skip(1)
"FileName: " cFileName skip(1)
"Project Name: " cProjectName skip(1)
"Project Display Name: " cProjectDisplayName skip(1)
view-as alert-box title "info".

Populate a temp-table with widget-handle in progress abl

I am trying to create dynamically a group of buttons, using this code:
DEFINE VAR temp-hand AS WIDGET-HANDLE.
DEFINE INPUT PARAMETER ipc AS CHARACTER NO-UNDO.
&global-define X VALUE(v + ipc )
CREATE BUTTON temp-hand
ASSIGN
FRAME = FRAME btn-frame:HANDLE
ROW = vdeInicio
COLUMN = 10
WIDTH = 19
LABEL = ipc
SENSITIVE = TRUE
VISIBLE = TRUE
TRIGGERS:
ON CHOOSE PERSISTENT RUN btn-mess IN THIS-PROCEDURE.
END TRIGGERS.
temp-hand:LOAD-IMAGE("imagenes/Entradas").
vdeInicio = vdeInicio + 3.57.
This works when I address a single button widget, also if a write a loop and call a procedure with this code in it, it creates multiple buttons but points to one handle, some told me than creating a temp table and saving there the widget handle may work, but I don´t know how to populate the table with the widget-handle, can you help me with this,
Something like this:
define temp-table tt_buttonList no-undo
field buttonId as integer
field buttonHandle as widget-handle
.
define variable i as integer no-undo.
do i = i to 5:
create tt_buttonList.
tt_buttonList.buttonId = i.
CREATE BUTTON tt_buttonList.buttonHandle
ASSIGN FRAME = FRAME btn-frame:HANDLE /* this is undefined in your example -- I have no idea where it came from */
ROW = i * 4
COLUMN = 10
WIDTH = 19
LABEL = string( i )
SENSITIVE = TRUE
VISIBLE = TRUE
.
end.
I've no idea why you would run code like this from a trigger procedure. While it might "work", mixing UI into db access code like that is really asking for serious trouble.

R save variable by string name

I want to name a variable by a string name.
variable_name=paste0("name",4,sep="")
assign(variable_name,55)
save(get(variable_name),file="file_name")
I got error msg: object ‘get(name)’ not found
but if I do
save(variable_name,file="file_name")
I only saved the string variable_name, which is "name 4" in this case.
How do I save the name4=55 as a file?

Resources