PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 22 → [WD22] memory table with internal window in the lines
[WD22] memory table with internal window in the lines
Débuté par Stefan Bentvelsen, 19 mai 2017 14:41 - 4 réponses
Posté le 19 mai 2017 - 14: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]
Posté le 19 mai 2017 - 22:08
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 asIW_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 ass_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
Posté le 20 mai 2017 - 16:25
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?
Posté le 20 mai 2017 - 21:14
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 asTrace(ParentTable[RowNum].Column4) //This would be the column where the primary ndx for the record is heldwill 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 thenTableName is string = ParentTable..Nameis your friend
Posté le 21 mai 2017 - 10:42
Hi DerekT,

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