RobertP
23rd January 2023, 18:02
We have 2 custom tables. Table Y references to X via a cmba (combined) field. Similar to b4 tdsls045 (Y) referencing tdsls041 (X).
I created a session type 3 based on table Y. Added some fields to the form from Table X. They do not display.
1 - In debug, table X values are in buffer, but not displayed on form....
2 - Added display("xxxxx.xxxx") in several UI sections, but then strangely, the buffered field value (enum) is reset to zero immediately after the call (in Debug)
The session simply refuses to display tablesfields from X on the form. Created a brand new session. Same behavior. Disabled the DAL. Still persists.
I'm out of ideas. Any clues?
Cheers
OmeLuuk
23rd January 2023, 18:16
Do you use a MMT session with relations between them defined?
And query.extend.from() + query.extend.where() in the before program?
RobertP
23rd January 2023, 18:32
Nope. Its just a simple session. Simple code
RobertP
23rd January 2023, 18:50
This is truly bizarre. I created an extern variable identical to the table field. Added it ( "form.991.dtab" ) to the form and voila, it displays correctly! But, the table field txmid991.dtab does not...
See my code below.
declaration:
table ttxmid992
table ttxmid991
extern domain tcmcs.str8 form.991.dtab
|****************************** PROGRAM SECTION ***************************
|****************************** ZOOM FROM SECTION ***************************
|****************************** FORM SECTION ***************************
|****************************** CHOICE SECTION ***************************
|****************************** FIELD SECTION ***************************
before.display.object:
if isspace(txmid991.dtab) then
message("hello")
endif
| display("txmid991.dtab")
form.991.dtab = txmid991.dtab
display.fld( actual.occ, "form.991.dtab" )
display.fld( actual.occ, "txmid991.dtab" )
OmeLuuk
23rd January 2023, 18:57
This is truly bizarre. I created an extern variable identical to the table field. Added it ( "form.991.dtab" ) to the form and voila, it displays correctly! But, the table field txmid991.dtab does not...
See my code below.
declaration:
table ttxmid992
table ttxmid991So far so good. But now I would like to suggest: |****************************** PROGRAM SECTION ***************************
before.program:
query.extend.select("txmid991.*")
query.extend.from("txmid991")
query.extend.where("txmid992.cmba refers to txmid991")
So your dataset will be read as one (linked) dataset.
|****************************** FIELD SECTION ***************************
before.display.object:
display.fld( actual.occ, "txmid991.dtab" )
Fun thing is Ctrl-Shift-8 revealing your query to read the data on screen shows you that those tables are linked now.
RobertP
23rd January 2023, 19:30
Thanks Omeluuk,
What I cant understand is how the table field values of txmid991 are actually in the buffer (due to table ref) and also available in debugger. And I can set variables equal to them, which display correctly. But they themselves are not being initialized. I can only imagine it's due to the reference from txmid992 to txmid991 via cmba combined field.
RobertP
23rd January 2023, 19:39
Hello Omeluuk,
Added the query.extends as you recommended. Still, the field txmid991.dtab is not displayed. This is really odd. It must be due to the reference...?
RobertP
23rd January 2023, 20:21
This combined field has 4 fields, because the primary index of txmid991 has 4 keys. Other combined fields referring other tables work fine. But they all have 2 or 3 fields. Not 4.
Is there some kind of "max keys" in LN for references to work correctly on dynamic forms?
OmeLuuk
23rd January 2023, 22:27
Can you post your query used to show records based on the session?
With and without my proposal?
When adding (referred) tables on the form (like description fields, addable in the DFE by clicking on the "link" icon) then 4GL will automagically link these fields onto the form. This will be shown on the Query tab in Ctrl-Shift-8.
Exact magic is unknown to me, but I suppose declaring the table in the script "re-initializes" a record buffer for the linked table thus conflicting with the default use. Declaring a table will declare all its table field variables (and more) as external variables and also its record buffer.
Running a session in debug mode will create external variable mappings for otherwise local variables so the debugger (as a separate session) also can manipulate these variables. So running in debug mode is not a full 100% proof that things are worked out correctly.
As far as I know there is no limit to combined fields to be correct. There may be on the length of references on database level, but this should be clear from the Known Limits section in the programmers manual.
OmeLuuk
23rd January 2023, 22:29
Hello Omeluuk,
Added the query.extends as you recommended. Still, the field txmid991.dtab is not displayed. This is really odd. It must be due to the reference...?
Then try without the "before display object" section. When read with the query extend one should assume it has the referred value.
RobertP
24th January 2023, 16:09
Hello Omeluuk,
Firstly, thanks for taking the time to look into this. Greatly appreciated.
I found the problem, but not sure how to solve it. BTW, This can easily be replicated in any Baan/Infor system. Table settings below.
The issue is Company number Zero - #3 below.
Parent table has 4 keys in primary index:
1 - Group Co (always <>0) domain tcncmp
2 - Environment (2xchar text)
3 - Company (default = 0 representing All companies, but can be co specific). Domain tcncmp
4 - Table (8xchar text)
Child table has an additional key – tablefield
1 - Group Co (always <>0) domain tcncmp
2 - Environment (2xchar text)
3 - Company (default = 0 representing All companies, but can be co specific). Domain tcncmp
4 - Table (8xchar text)
5 - Table-field (8xchar text)
The reference from child to parent via combined field works perfectly now as long as #1 GROUP & #3 Company both have values greater than ZERO. But, by default, company #3 will be zero. So the reference is problematic. It corrupts calls to the parent from child in program scripts and DAL.
Initially, I thought it could be the special company domains tccomp and tcncmp. So I created a new tx domain of type integer. But..... the issue persists. See attached screenshot.
Note – I looked at table tdsls401 and tdsls402. 401 contains sqnb (also integer) usually zero. 402 references 401 perfectly and the related sessions seem to work as expected.
I hope we can solve this. Else I will wait for official support and give an update here anyhow.
Cheers
OmeLuuk
25th January 2023, 01:02
Hello Omeluuk,
Firstly, thanks for taking the time to look into this. Greatly appreciated.WelcomeI found the problem, but not sure how to solve it. BTW, This can easily be replicated in any Baan/Infor system. Table settings below.
The issue is Company number Zero - #3 below.
Similar I have such table field:... and (tccom905.comp = :4 or tccom905.comp = 0)
order by tccom905._index1 desc
as set with 1 rows
hint use index 1 on tccom905
wherebind(4, get.compnr()) But in my case it is not in a combined field nor index. Eager to learn what the solution is Support will be offering...
RobertP
25th January 2023, 07:55
I'm curious to know whether this is a Database issue, so if anyone has the time to reproduce the setup (2 tables, cmba ref and 2 sessions), I'd massively appreciate it .
Cheers!
RobertP
25th January 2023, 09:15
FYI, for now I'm converting comp field to use domain txvcmp (virtual co - now a string) in order to utilize the zero (blank) and easy convert the domain back to integer later (which should auto-convert the data too). And, I also wont have sql calls.
RobertP
31st January 2023, 19:29
Reference mode on parent 'combined' field can be set to "mandatory" while it's children may be set to "mandatory unless empty" (if related to other tables individually).
References then appear correctly on the form.
No problems found [yet] with ref mode mandatory.
This solution works for both numbered fields = 0 and empty strings.
Cheers
OmeLuuk
2nd February 2023, 18:11
Glad you found and shared your solution.