[[https://www.revelation.com/|Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community]]
==== Edit-tables - basic readings for AREV'rs (OpenInsight Specific) ====
=== At 10 SEP 2001 08:12:44PM Wilhelm Schmitt wrote: ===
{{tag>"OpenInsight Specific"}}
Variable length and multivalues are one of the key features I like a lot in AREV, because it allows you to work with one record per document and maintain easy structures.
In one of our (AREV/OICGI) applications we make heavy use of MV,SMV, TM and STM; we also pass the same data over to OICGI and display them over the WEB with very little changes. This is basically done through traditional AREV programming structures. So far so good, until...
...one of these days, inspired by the "Notes on Migrating..." I was trying to test the benefits of windows programming and other fancy stuff, and really ended up with mixed feelings, when it came down to basics like associated multivalues.
I would like to do this:
1. Different popups on different fields of the same edittable...
2. Leave empty rows empty, even if there are symbolics. (A calculated MV field (QTY***UNIT_COST) showed "0" for all empty rows in the edittable.)
3. Data entry tables with zooming through SMV, TM and STM.
Could anyone please tell me, where to find reading material on this to Open the Insight?
(I couldn't find too much under Edit Table Controls in the "Guide to Application Development". Where did my WINDOW COMMONS go to?).
Hints and comments will be highly appreciated.
Wilhelm
----
=== At 10 SEP 2001 08:33PM Scott, LMS wrote: ===
Hi Wilhelm
Try doing a search of the OI discussion forum for "ZOOM" or "EDITZOOM", there is a fairly recent discussion on how to make popups on each field of an edit table.
The alternate way is to have a new button, and edit button and a delete button for the edit table, and when you click on new or edit it brings up a input dialog box form. Of course there are times when tabular input would be much nicer for everyone.
If you want your MV not to show zero in the quantity, I think I'd put something in it like
if qty=' and unit_cost=' then
@ans='
else
* do validation and calculation and set @ANS
end
If you let your edit table get completely empty, it gets difficult to enter any data into it. I usually have some sort of check called from the gotfocus event so that if you click on the edittable and it is empty, it sets the array or list to @FM, thereby giving you a row to enter data.
I also use the lostfocus event (and the save/write validation) to remove empty rows neatly.
All of this is facilitated by the use of commuter and/or promoted events. If you are just starting your conversion, search the forum for these because they are easiest to implement when you plan ahead for them.
And the best documentation for "how to " is here in the forums and the SENL at sprezzatura.com - the SENL has an editor it might be easier to start there.
Scott, LMS
The more I know, the more I know I don't know.
----
=== At 11 SEP 2001 09:43AM Wilhelm Schmitt wrote: ===
Scott,
thank you for the comments. T
The EditZoom- and also several other postings on AMV's seem to clear up my mind. I also debug the function calls and look first at the EDITTABLE properties. This helps also quite a lot.
Regarding the multiple POPUPs in the EDITTABLE, I would like to trigger them, depending on the number of the current AMV prompt.
If the edittable has an OPTIONS quickevent to show APP*POPUP**POP_A for the first prompt:
1. how do I have to write the calls for the different popups and stuff the selected value into the current prompt,
2. how do I avoid double execution of the default popup,
in the following example?
begin case
case selpos=1
* just execute APP*POPUP**POP_A as defined in the OPTIONS quickevent
???
case selpos=2
* show popup APP*POPUP**POP_B and take in the selected values
???
case selpos=3
etc....
end case
Thanks again.
Wilhelm
----
=== At 11 SEP 2001 12:25PM Scott, LMS wrote: ===
Hi Wilhelm
Bear in mind I haven't needed to do one of these popups for each cell although I read the relevant threads with interest.
Oystein and A Becker seem to be the current experts.
Also I'm at home so it is a bit hard to check the help stuff right now.
I think you get one options event for the whole edit table. I think I'd use the various pos properties (PREVPOS, SELPOS, CELLPOS and others) to figure out where the cursor was in the edit table when the options button was pressed ie do a get_property for these properties from your options routine (be it a commuter proc routine or event script or whatever).
Based on the cursor position, I'd create a case statement to run which ever pop up bit was relevant for that cell, and return the info to that cell. I think there is something called TEXTPOS or is that TEXTXY or similar variation on the set_property that will let you set a cell of a table without setting the whole array. Or you can grab the whole array and just set the cell value that you want and then put the whole array back.
BTW since we are doing edit tables, to get the maximum number of rows that you can, use "-1" in the row limit in the edittable properties (under "More" I think) - this allows you to get more info into your edit table based on how much RAM your computer has.
Normally there is a 32K limit on formatted data in an edittable. I did set up a whole paging system that allowed data to be loaded up a bit at a time into the edittable when a next_page button was clicked. Of course I had to unbind the edittable and do the data update with code in the save and write events.
If you have a known finite limit to the rows, things are much easier.
Scott.
----
=== At 12 SEP 2001 09:27AM Don Miller - C3 Inc. wrote: ===
Here's a sample of what we do in edit_tables to provide multiple popup / functions. It is called via a double-click event on a database bound edit_table:
****************************************************
*PROCEDURE TO UPDATE FOR SPECIFIC DATATABLE BOX
DECLARE FUNCTION REPOSITORY,MSG,POPUP_MONTH_NEW
DECLARE SUBROUTINE SET_PROPERTY,MSG,POPUP_MONTH_NEW
* first get the control which has focus
CTRL=GET_PROPERTY(@WINDOW,"FOCUS") ;* SEE WHERE WE ARE
* hext see where we are in the structure (column/row)
WHERE=GET_PROPERTY(CTRL,"SELPOS") ;* WHERE WAS THE FOCUS COL/ROW
ARRAY=GET_PROPERTY(CTRL,"ARRAY") ;* GET THE ARRAY PROPERTY
* DEBUG
COL=WHERE ;* COLUMN NUMBER
* COLUMN 1 IS DATE
* COLUMNS 2/3 EVENTNAME EVENTNOTES
BEGIN CASE
CASE COL=1
NULLVAR=POPUP_MONTH_NEW('','','')
CASE COL=2
TABLE=ARRAY
DATES=TABLE
DATES=ICONV(DATES,'D')
NAMES=TABLE
TEXT =TABLE
SWAP CHAR(13):CHAR(10) WITH @TM IN TEXT
K1=COUNT(DATES,@VM)+(DATES NE '')
* BUILD A VIRTUAL POPUP THAT IS SORTABLE
*****
$INSERT POPUP_EQUATES
POP_DEF='
POP_DEF='
* BUILD THE COLUMN HEADINGS
* 3 COLUMN HEADINGS:
* DATE / NAME OR EVENT /1'ST LINE OF NOTES
* F W J HJ CONV HDG
FMT=1:@SVM:10:@SVM:'R':@SVM:'C': @SVM:'D4/':@SVM:"DATE"
FMT:=@VM
FMT:= 2:@SVM:20:@SVM:'L':@SVM:'C' : @SVM:'':@SVM:"NAME/EVENT"
FMT:=@VM
FMT:= 3:@SVM:50:@SVM:'L':@SVM:'C' : @SVM:'':@SVM:"NOTES"
FMT:=@VM
POP_DEF=FMT
TITLE="
POP_DEF=TITLE
DISPDATA='
FOR I=1 TO K1
FOR J=1 TO 3
IF J=1 THEN TMP=DATES
IF J=2 THEN TMP:=@SVM:NAMES
IF J=3 THEN TMP:=@SVM:FIELD(TEXT,@TM,1)
NEXT J
DISPDATA=TMP
NEXT I
POP_DEF=DISPDATA
POP_DEF=1
POP_DEF=L'
POP_DEF=1
POP_DEF=P'
POP_DEF=1
POP_DEF=1 ;* BUTTONS ON BOTTOM RATHER THAN SIDE
POP_DEF=1 ;* NO NUMBERS ON LEFT
POP_DEF=1 ;* NUMBER BUTTONS ON LEFT
POP_DEF=1 ;* ALLOW SORT
POP_DEF=1 ;* ALLOW SEARCH
NULLVAR=POPUP(@WINDOW,POP_DEF)
* see if something was selected .. if so, put the cursor there
IF LEN(NULLVAR) THEN
ROW=NULLVAR
WHERE=1
WHERE=ROW
SET_PROPERTY(CTRLENTID,"SELPOS",WHERE)
END
CASE COL=3
CALL ZOOM(XXX) ;* ALLOW TEXT ZOOMING
END CASE
RETURN 1
********************************************************
Note that two of the calls (Columns 1 and 3 are written so that they automatically update Column 2 is different since it's built on the fly.
Hope this is useful to someone ..
Don Miller
C3 Inc.
----
=== At 12 SEP 2001 11:54PM Wilhelm Schmitt wrote: ===
Don,
I have gone through your sample: this is exactly what I was looking for.
So I pasted it into the event script for the edittable (OPTIONS) and watched the variables and property values in the debugger. After replacing the virtual popup with popup record-ids now it really looks transparent.
Got only one problem: How do I put the updated array back into the edittable? There is something wrong with my SET_PROPERTY call. What is it?
Thank you very much for the example.
Wilhelm
* * * * * * * * * * * * *
* Simplified Edittable OPTIONS event script
* * * * * * * * * * * * *
* procedure to update for specific datatable box
DECLARE FUNCTION REPOSITORY,MSG,POPUP_MONTH,POPUP
DECLARE SUBROUTINE SET_PROPERTY,MSG,POPUP_MONTH
* first get the control which has focus
CTRL=GET_PROPERTY(@WINDOW,"FOCUS") ;* see where we are
* next see where we are in the structure (column/row)
WHERE=GET_PROPERTY(CTRL,"SELPOS") ;* where was the focus (col/row)
ARRAY=GET_PROPERTY(CTRL,"ARRAY") ;* get the array property
COL=WHERE ;* column number
ROW=WHERE ;* row number
NULLVAR='
* popup record @ids according to column of edittable
POPNAME=BARDA_MAT'
POPNAME=BARDA_UM'
BEGIN CASE
CASE COL=1 OR COL=4
NULLVAR=POPUP(@WINDOW,'','POPUPS**':POPNAME)
CASE COL=2
NULLVAR=POPUP_MONTH('','','')
CASE 1
CALL MSG('Nothing to do ...')
END CASE
* debug
IF LEN(NULLVAR) THEN
ARRAY=NULLVAR
SET_PROPERTY(CTRLENTID,"ARRAY")
END
RETURN 0
----
=== At 13 SEP 2001 12:47AM Donald Bakke wrote: ===
Wilhelm,
You forgot to add the value parameter in your Set_Property command. Instead of:
ARRAY=NULLVAR
SET_PROPERTY(CTRLENTID,"ARRAY")
it should have read like:
ARRAY=NULLVAR
SET_PROPERTY(CTRLENTID,"ARRAY",ARRAY)
dbakke@srpcs.com
[url=http://www.srpcs.com]SRP Computer Solutions, Inc.[/url]
[img]http://www.srpcs.com/srpicon1.gif[/img]
-----------------------------7d1366ced4--
----
=== At 13 SEP 2001 08:40AM Wilhelm Schmitt wrote: ===
Thanks to everybody for the help.
Wilhelm
----
=== At 13 SEP 2001 09:20AM Don Miller - C3 Inc. wrote: ===
Here's your code:
IF LEN(NULLVAR) THEN
ARRAY=NULLVAR
SET_PROPERTY(CTRLENTID,"ARRAY")
END
RETURN 0
It should read:
IF LEN(NULLVAR) THEN
ARRAY=NULLVAR
SET_PROPERTY(CTRLENTID,"ARRAY",ARRAY)
END
RETURN 1 ;* I would make it a 1 just to let anything else continue
That should do it.
Don Miller
C3 Inc.
[[https://www.revelation.com/revweb/oecgi4p.php/O4W_HANDOFF?DESTN=O4W_RUN_FORM&INQID=NONWORKS_READ&SUMMARY=1&KEY=01CF96A22C5745FB85256AC400012A9C|View this thread on the forum...]]