## Calculate the lenght of field contens

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
kno_dk
Posts: 110
Joined: Tue Feb 23, 2016 12:00 am

### Calculate the lenght of field contens

Hi.

Is it possible to calculate the lenght of the content in field so I can set the width of the field in a RP?

/Klaus

atostaine
Posts: 456
Joined: Wed Jan 20, 2016 7:38 am

### Re: Calculate the lenght of field contens

Isn't it curchars? You might have to add a trim in there.

https://docs.lansa.com/14/en/lansa016/p ... rchars.htm
Art Tostaine

kno_dk
Posts: 110
Joined: Tue Feb 23, 2016 12:00 am

### Re: Calculate the lenght of field contens

Hi

Thanks.

it gives me the numbers of letters in the field.

I need the size in the format of width. I need it to make some kind of breadcrum, like:

If i just put the fields after each other I will get some space betweend the fields.

Klaus

dannyoorburg
Posts: 169
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

### Re: Calculate the lenght of field contens

I usually make breadcrumbs like that with labels flowing left to right with variable width....

Cheers,
Danny

kno_dk
Posts: 110
Joined: Tue Feb 23, 2016 12:00 am

### Re: Calculate the lenght of field contens

Hi

thanks

But I still need to change the width of the labels so it is like

and not like :

My breadcrumbs could by VW or Mercedes I would like the > be just right to the eg VW > and Mercedes >

/Klaus

dannyoorburg
Posts: 169
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

### Re: Calculate the lenght of field contens

Hi Klaus,

Try the sample code below

Maybe this is what you want.

Cheers,
Danny

Code: Select all

``````Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>) LayoutManager(#LayoutMain)

Define_Com Class(#PRIM_TBLO) Name(#LayoutMain)
Define_Com Class(#PRIM_TBLO.Column) Name(#LayoutMainColumn1) DisplayPosition(1) Parent(#LayoutMain)
Define_Com Class(#PRIM_TBLO.Column) Name(#LayoutMainColumn2) DisplayPosition(2) Parent(#LayoutMain) Width(20)
Define_Com Class(#PRIM_TBLO.Column) Name(#LayoutMainColumn3) DisplayPosition(3) Parent(#LayoutMain)
Define_Com Class(#PRIM_TBLO.Row) Name(#LayoutMainRow1) DisplayPosition(1) Parent(#LayoutMain) Height(200) Units(Pixels)
Define_Com Class(#PRIM_TBLO.Row) Name(#LayoutMainRow2) DisplayPosition(2) Parent(#LayoutMain)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutMainItem1) Alignment(TopLeft) Column(#LayoutMainColumn2) Flow(Right) Manage(#Caption1) Parent(#LayoutMain) Row(#LayoutMainRow1) Sizing(ContentWidth)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutMainItem2) Alignment(TopLeft) Column(#LayoutMainColumn2) Flow(Right) Manage(#Text1) Parent(#LayoutMain) Row(#LayoutMainRow1) Sizing(ContentWidth)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutMainItem3) Alignment(TopLeft) Column(#LayoutMainColumn2) Flow(Right) Manage(#Caption2) Parent(#LayoutMain) Row(#LayoutMainRow1) Sizing(ContentWidth)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutMainItem4) Alignment(TopLeft) Column(#LayoutMainColumn2) Flow(Right) Manage(#Text3) Parent(#LayoutMain) Row(#LayoutMainRow1) Sizing(ContentWidth)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutMainItem5) Alignment(TopLeft) Column(#LayoutMainColumn2) Flow(Right) Manage(#Caption3) Parent(#LayoutMain) Row(#LayoutMainRow1) Sizing(ContentWidth)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutMainItem6) Alignment(TopLeft) Column(#LayoutMainColumn2) Flow(Right) Manage(#Text5) Parent(#LayoutMain) Row(#LayoutMainRow1) Sizing(ContentWidth)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutMainItem7) Alignment(TopLeft) Column(#LayoutMainColumn2) Flow(Right) Manage(#Caption4) Parent(#LayoutMain) Row(#LayoutMainRow1) Sizing(ContentWidth)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutMainItem8) Alignment(TopLeft) Column(#LayoutMainColumn2) Manage(#Button1) Parent(#LayoutMain) Row(#LayoutMainRow2) Sizing(None) Flow(Right) MarginBottom(8) MarginLeft(8) MarginRight(8) MarginTop(8)
Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutMainItem9) Alignment(TopLeft) Column(#LayoutMainColumn2) Manage(#Button2) Parent(#LayoutMain) Row(#LayoutMainRow2) Sizing(None) Flow(Right) MarginBottom(8) MarginLeft(8) MarginRight(8) MarginTop(8)

Define_Com Class(#PRIM_MD.Label) Name(#Caption1) Caption('Home page') DisplayPosition(1) Left(55) Parent(#COM_OWNER) TabPosition(7) Top(0) Width(75)
Define_Com Class(#PRIM_MD.Label) Name(#Text1) Caption('>') DisplayPosition(2) Left(130) Parent(#COM_OWNER) TabPosition(3) Top(0) Width(11)
Define_Com Class(#PRIM_MD.Label) Name(#Caption2) Caption('Services') DisplayPosition(3) Left(141) Parent(#COM_OWNER) TabPosition(6) Top(0) Width(55)
Define_Com Class(#PRIM_MD.Label) Name(#Text3) Caption('>') DisplayPosition(4) Left(196) Parent(#COM_OWNER) TabPosition(2) Top(0) Width(11)
Define_Com Class(#PRIM_MD.Label) Name(#Caption3) Caption('About Us') DisplayPosition(5) Left(207) Parent(#COM_OWNER) TabPosition(4) Top(0) Width(61)
Define_Com Class(#PRIM_MD.Label) Name(#Text5) Caption('>') DisplayPosition(6) Left(268) Parent(#COM_OWNER) TabPosition(1) Top(0) Width(11)
Define_Com Class(#PRIM_MD.Label) Name(#Caption4) Caption('Latest Newsletter') DisplayPosition(7) Left(279) Parent(#COM_OWNER) TabPosition(5) Top(0) Width(114)
Define_Com Class(#PRIM_MD.RaisedButton) Name(#Button1) Caption('NEWSLETTER') DisplayPosition(8) Left(63) Parent(#COM_OWNER) TabPosition(9) ThemeDrawStyle('MediumTitle') Top(200)
Define_Com Class(#PRIM_MD.RaisedButton) Name(#Button2) Caption('MY ACCOUNT') DisplayPosition(9) Left(179) Parent(#COM_OWNER) TabPosition(8) ThemeDrawStyle('MediumTitle') Top(200)

Evtroutine Handling(#Button1.Click)

#Caption2 := 'Services'
#Caption3 := 'About Us'
#Caption4 := 'Latest Newsletter'

Endroutine

Evtroutine Handling(#Button2.Click)

#Caption2 := 'My Account'
#Caption3 := 'Latest Statements'
#Caption4 := 'May 2019'

Endroutine

End_Com

``````

kno_dk
Posts: 110
Joined: Tue Feb 23, 2016 12:00 am

### Re: Calculate the lenght of field contens

Hi

Thanks

That was what I needed.

/klaus