Skip to main content

beginner with struct: selecting some fields from occ

  • July 22, 2021
  • 4 replies
  • 1 view

Forum|alt.badge.img

Hi

I'm just beginning to use struct

moving full occurrences ok

but I want to move to a struct  some fields of each occurence

entity : order line and included delivery line (one to one relation)

so I want to take for all occurrences of order line,

order line label + delivery line quantity

so I build struct

 l_line->$newstruct

l_line→libelle=$newstruct

l_line->quantity=$newstruct

componenttostruct l_line, "orderline"   → gave me all fields

How can I do this


Dominique





4 replies

Iain Sharp
Forum|alt.badge.img+5
  • Inspiring
  • July 22, 2021

Hi

I'm just beginning to use struct

moving full occurrences ok

but I want to move to a struct  some fields of each occurence

entity : order line and included delivery line (one to one relation)

so I want to take for all occurrences of order line,

order line label + delivery line quantity

so I build struct

 l_line->$newstruct

l_line→libelle=$newstruct

l_line->quantity=$newstruct

componenttostruct l_line, "orderline"   → gave me all fields

How can I do this


Dominique





To put those two fields in, it's :-



l_line = $newstruct
l_line→libelle = libelle.orderline
l_line→quantity = quantity.orderline



so a full order might look like

l_order = $newstruct
forentity "orderline"
  l_order->Line{$curocc("orderline")} = $newstruct
  call add_line(l_order->Line{$curocc("orderline")})
endfor

.
.
.
.
entry add_line
params
 struct l_line : INOUT
endparams

l_line→libelle = libelle.orderline 
l_line→quantity = quantity.orderline
etc.

end

Forum|alt.badge.img
  • Author
  • Participating Frequently
  • July 22, 2021

Hi

I'm just beginning to use struct

moving full occurrences ok

but I want to move to a struct  some fields of each occurence

entity : order line and included delivery line (one to one relation)

so I want to take for all occurrences of order line,

order line label + delivery line quantity

so I build struct

 l_line->$newstruct

l_line→libelle=$newstruct

l_line->quantity=$newstruct

componenttostruct l_line, "orderline"   → gave me all fields

How can I do this


Dominique





Thanks Iain

hard to find all these in the documentation


Gianni Sandigliano
Forum|alt.badge.img

Thanks Iain

hard to find all these in the documentation

Hi Dominique,

It could be helpful this nice page into official documentation; it is including many struct code samples.

Gianni


Forum|alt.badge.img
  • Author
  • Participating Frequently
  • July 24, 2021

Thanks Iain

hard to find all these in the documentation

Thanks Gianni

nice page