Page 1 of 1

Ancestor fields in group_by and def_list

Posted: Thu Feb 28, 2019 2:58 am
by jyoung
If I define a component that has three fields in it.

Code: Select all

begin_com role(*EXTENDS #PRIM_PANL) displayposition(1) height(270) left(0) tabposition(1) top(0) width(500) layoutmanager(#Layout1)

* ================================================================================
* LAYOUT
* ================================================================================
define_com class(#PRIM_TBLO) name(#Layout1)
define_com class(#PRIM_TBLO.Row) name(#Layout1Row1) displayposition(1) parent(#Layout1)
define_com class(#PRIM_TBLO.Column) name(#Layout1Column1) displayposition(1) parent(#Layout1)
define_com class(#PRIM_TBLO.Item) name(#Layout1Item1) alignment(TopLeft) column(#Layout1Column1) manage(#OBOFID) parent(#Layout1) row(#Layout1Row1) sizing(FitToWidth) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#Layout1Item2) alignment(TopLeft) column(#Layout1Column1) manage(#OBBTC) parent(#Layout1) row(#Layout1Row1) sizing(FitToWidth) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#Layout1Item3) alignment(TopLeft) column(#Layout1Column1) manage(#OBPLCN) parent(#Layout1) row(#Layout1Row1) sizing(FitToWidth) flow(Down)

* ================================================================================
* UI COMPONENTS
* ================================================================================
define_com class(#OBOFID.EditField) name(#OBOFID) displayposition(1) left(0) parent(#COM_OWNER) tabposition(1) top(0) width(500) caption('Office Number') captiontype(Caption) readonly(True) enabled(False)
define_com class(#OBBTC.EditField) name(#OBBTC) displayposition(2) left(0) parent(#COM_OWNER) tabposition(2) top(75) width(500) caption('Benefit Number') captiontype(Caption) readonly(True) enabled(False)
define_com class(#OBPLCN.EditField) name(#OBPLCN) displayposition(3) left(0) parent(#COM_OWNER) tabposition(3) top(150) width(500) caption('Plan Number') captiontype(Caption) readonly(True) enabled(False)

* other code omitted
end_com
And then use that component as the ancestor of another component, the child component has the fields defined as *ANCESTOR

Code: Select all

begin_com role(*EXTENDS #OFCBOIBenefitPanel) height(433) width(657) layoutmanager(#Layout)

* ================================================================================
* LAYOUT
* ================================================================================
define_com class(#PRIM_TBLO) name(#Layout)
define_com class(#PRIM_TBLO.Column) name(#LayoutColumn1) displayposition(1) parent(#Layout)
define_com class(#PRIM_TBLO.Column) name(#LayoutColumn2) displayposition(2) parent(#Layout)
define_com class(#PRIM_TBLO.Column) name(#LayoutColumn3) displayposition(3) parent(#Layout)
define_com class(#PRIM_TBLO.Row) name(#LayoutRow1) displayposition(1) parent(#Layout)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem1) manage(#OBOFID) parent(#Layout) row(#LayoutRow1) sizing(FitToWidth) column(#LayoutColumn1) alignment(TopLeft) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem2) manage(#OBBTC) parent(#Layout) row(#LayoutRow1) sizing(FitToWidth) column(#LayoutColumn1) alignment(TopLeft) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem3) manage(#OBPLCN) parent(#Layout) row(#LayoutRow1) sizing(FitToWidth) column(#LayoutColumn1) alignment(TopLeft) flow(Down)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem4) alignment(TopLeft) column(#LayoutColumn2) manage(#BPU1) parent(#Layout) row(#LayoutRow1) sizing(FitToWidth) flow(Down) marginleft(5)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem5) alignment(TopLeft) column(#LayoutColumn2) manage(#BPU2) parent(#Layout) row(#LayoutRow1) sizing(FitToWidth) flow(Down) marginleft(5)

* ================================================================================
* UI COMPONENTS
* ================================================================================
define_com class(#BPU1.EditField) name(#BPU1) displayposition(4) left(224) parent(#COM_OWNER) tabposition(4) top(0) width(214) caption('Usage Modifer') captiontype(Caption)
define_com class(#BPU2.EditField) name(#BPU2) displayposition(5) left(224) parent(#COM_OWNER) tabposition(5) top(75) width(214) caption('Benefit Factor') captiontype(Caption)

define_com class(*ANCESTOR) name(#OBBTC) width(219)
define_com class(*ANCESTOR) name(#OBOFID) width(219)
define_com class(*ANCESTOR) name(#OBPLCN) width(219)

* other code omitted

end_com
When I try to put these fields in group_by I get an error "Expression #OBBTC does not identify a field".

This means that I cannot have those fields as part of a group_by or defined in a list with def_list. If I need to pass these fields to a Server Module, I can't do so in a group or list.

I don't understand why and hope that someone can enlighten me.

Also, how do others get around this?

Thanks,
Joe

Re: Ancestor fields in group_by and def_list

Posted: Thu Feb 28, 2019 8:26 am
by atostaine
I thought Group_by only works with repository fields. I bet you can't put your group_by in the ancestor either.

Art

Re: Ancestor fields in group_by and def_list

Posted: Thu Feb 28, 2019 8:39 am
by MarkD
Can you put anything defined with a Define_Com (versus a DEFINE or the dictionary) into a GROUP_BY?

Re: Ancestor fields in group_by and def_list

Posted: Fri Mar 01, 2019 2:15 am
by jyoung
In the ancestor, they are just fields so I can add them in the group by

Here is a test of the ancestor (TestBasePanel)

Code: Select all

function options(*DIRECT)
begin_com role(*EXTENDS #PRIM_PANL) DisplayPosition(1) Height(270) Left(0) TabPosition(1) Top(0) Width(500) LayoutManager(#Layout1)

define_com class(#PRIM_TBLO) name(#Layout1)
define_com class(#PRIM_TBLO.Row) name(#Layout1Row1) DisplayPosition(1) Parent(#Layout1)
define_com class(#PRIM_TBLO.Column) name(#Layout1Column1) DisplayPosition(1) Parent(#Layout1)
define_com class(#PRIM_TBLO.Item) name(#Layout1Item1) Alignment(TopLeft) Column(#Layout1Column1) Parent(#Layout1) Row(#Layout1Row1) Sizing(FitToWidth)

define_com class(#STD_STRNG.EditField) name(#STD_STRNG) DisplayPosition(1) Parent(#COM_OWNER) TabPosition(1) Width(500)


group_by name(#MYGroupBy) fields(#STD_STRNG)
end_com
Here is my TestChildPanel

Code: Select all

function options(*DIRECT)
begin_com role(*EXTENDS #TestBasePanel) LayoutManager(#Layout)

define_com class(#PRIM_TBLO) name(#Layout)
define_com class(#PRIM_TBLO.Column) name(#LayoutColumn1) DisplayPosition(1) Parent(#Layout)
define_com class(#PRIM_TBLO.Column) name(#LayoutColumn2) DisplayPosition(2) Parent(#Layout)
define_com class(#PRIM_TBLO.Row) name(#LayoutRow1) DisplayPosition(1) Parent(#Layout)
define_com class(#PRIM_TBLO.Item) name(#LayoutItem1) Alignment(TopLeft) Column(#LayoutColumn1) Manage(#STD_STRNG) Parent(#Layout) Row(#LayoutRow1) Sizing(FitToWidth)

define_com class(*ANCESTOR) name(#STD_STRNG) Width(250)

define_com class(#PRIM_ALPH) name(#MyComponent)

group_by name(#MyGroupBy) fields(#STD_STRNG)

group_by name(#MyComponentGroupBy) fields(#MyComponent)
end_com
I expect MyComponentGroupBy to fail, as I did not expect to be able to put a component in it.

However, I expected MyGroupBy to work, because it is a field, albeit defined in the base panel.
Capture.PNG
Capture.PNG (27.12 KiB) Viewed 2760 times
I noticed that the define_com class(*ANCESTOR) does not appear, until I change the layout in the child class.
If I don't change the layout and I don't have the *ANCESTOR in the child, I can have STD_STRNG in the group_by; however, I don't know if this is the child's #STD_STRNG or the ancestor's #STD_STRNG.

Re: Ancestor fields in group_by and def_list

Posted: Fri Mar 01, 2019 2:43 pm
by bark
Hi Joe

The expression error in the #MyGroupBy looks wrong and looks like a defect that you should report to LANSA support.

HTH
bark

Re: Ancestor fields in group_by and def_list

Posted: Sat Mar 02, 2019 2:07 am
by jyoung
Done. I'll post their response when I hear back.

Thanks,
Joe

Re: Ancestor fields in group_by and def_list

Posted: Wed Mar 06, 2019 1:09 am
by jyoung
This is been accepted as a correction to be released in a future EPC.

Thanks,
Joe