Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 7 Monaten
Letzter Beitrag:
vor 5 Monaten, 2 Wochen
Beteiligte Autoren:
Stefan Bentvelsen, DerekT, Mark Crichton

[WD22] memory table with internal window in the lines

Startbeitrag von Stefan Bentvelsen am 19.05.2017 12:41

Hi,

for test I made a memory table with an internal window in each table line (see picture). In the internal window I made two little memory tables and some edit controls and a button. First challenge I met is to fill the internal window of the table lines. I cannot find how to do that.

Second challenge is that I would like to have all lines (with internal window) expanded, so the internal window for each tableline is visible. I can not find a property to make this happen, also not per individual line.

Who can help me, please?

[attachment 2330 WD22TestIWinTable.PNG]

Antworten:

Stefan
You will need to treat this as with any other IW.

I have no idea what info your IW is supposed to display but for arguments sake I will assume that this a Header/Lines scenario.

On a row selection section of the parent table you need send a unique value to the IW as
IW_MyInternalWin = PK_Record


In the IW declare a variable to receive the value sent - say 's_MyPK_Received'

This value sent will be received in the 'Assigning the ...Value Property' of the IW which in turn will update the variable as
s_MyPK_Received = MySelf..Value


The IW will also have a local procedure that will populate a table, for example, containing the 'Line' records.
Step 2 on the selection section of the parent table is to execute this procedure.


Part 2 of your question depends on the content of the parent table.
In the above example only a single set of child records can be displayed by default as each row would have a different unique ID.
This is to me what this type of functionality is designed to do.

To display all child records regardless of which row is selected require a different approach.
I have not tried but a possible way to overcome this would be loop through your main table, set the 's_MyPK_Received' and execute the procedure of the IW for each record.
Execute the IW procedure for each record and display the information using a looper.

You will need to ensure that this only happens on the first select I guess and the time it takes may be an issue.
Good luck

von DerekT - am 19.05.2017 20:08
Hi DerekT,

thank you very much for your help.
I've tried your suggestion(s), but with the code in "On a row selection section of the parent table":

IW_Weging = COL_ID

I got (at runtime) the error "IW_Weging control is unknown"

while in my table I have 2 colums (COL_Desription, COL_ID). In the GUI tab of the table I have defined the IW_Weging internal Window for row details. What am I missing?

I discovered that a TableExpandAll(MyTable) after the initialization of the table, does expand all the table lines at ones. Works very well.

Btw: the data in a table-line (+ internal window) is a stable with number, startdate en number of chickens in it and in the internal window a table for weight-data (left) and a table for slaughterdates, weight on that date and number of chickens (right).

von Stefan Bentvelsen - am 20.05.2017 14:25
Stefan

Ha ha, my bad.
I had not actuall played with this so assumed, incorrectly, that it would function in a similar manner to standar IW's.
So ignore what I said - although the first part is still valid as the method to initialize the content of an IW in 'normal' use.

Now had a play and I believe this is what you need to do.........

Declare your internal window with
PROCEDURE InternalWindow1(ParentTable is Control,RowNum is int)


According to the Help {See: Table/Display Options - Display the details of a row in an internal window.) these will contain the name of the parent table and row number selected at run time.
NOT SO - I found that both in fact contain the 'number of the selected row.
It does however function correctly as
Trace(ParentTable[RowNum].Column4) 
//This would be the column where the primary ndx for the record is held
will return the value of the nominated column.

I am assuming that a local procedure would be called at this point, using this ID, to populate the IW display.
As long as the call to this is made from the 'Global Declaration@ or 'End of Initialization' code blocks population of the IW will complete before it is displayed.

Performance from the perspective of the parent window will of course be determined by how much processing the IW requires.

One last thig - If you do need the name of the parent window for any reason then
TableName is string = ParentTable..Name
is your friend

von DerekT - am 20.05.2017 19:14
Hi DerekT,

thanks again for your help.
Now, it works like a charm.

von Stefan Bentvelsen - am 21.05.2017 08:42
HI Folks

Just a note to add here. Love this feature of WD22.

Be aware that the "Selecting a row of Table.... " does not fire if the user clicks on the [+] of a row that does not yet have focus.

Need to add this code to the "Expanding Details of row of Table..." as well.

EG: I pass the row "link" to a global variable ( e.g. gcCustomerUID set in the project element code) and run the following code in "Global declaration.." of the internal window.
Hexecutequery(Qry_saleslines,gvCustomerUID,Null)
Tabledisplay(Table_SalesLines,taStart)

could have used
Tabledisplay(Table_salesLines,taReExecuteQuery)

Would be nice if one could resize the internal window to shrink or expand to display number of lines in the query.

von Mark Crichton - am 01.07.2017 09:06
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.