add-calc-column on dynamic browse

schaapie

Member
I'm trying to add a calc column on a dynamic browse which is populated by a dynamic query.
So when I start off, i don't know anything about what will be in the browse.
I'm able to open the query (with multible buffers) and populate the browse, but when I try to add/fill the calculated column I get stuck.
Code works as follows:
a dynamic query is opened with buffer TabProd with field SortDesc
the temp-table ttColumn could hold a record with:
ttColumn.Calcstring = "substring(TabProd.SortDesc,4)"
ttColumn.Label = "Product description"

I want to use:
Code:
for each ttColumn no-lock:
  hBrowse:add-calc-column("char","x(50)", ttColumn.Calcstring,ttColumn.Label).
end.
which should populate a column "Product description" with the substring-value's of the TabProd.SortDesc value's, but progress populates every row with "substring(TabProd.SortDesc,4)" the literal value, not the calculated value.

What to do?
Thanks
Niek Knijnenburg
 

jongpau

Member
A calculated column means that you have to do the calculations. Progress will not do them for you (unfortunately). So, probably in the ROW-DISPLAY trigger of the browse you will want to work out the values) and put it in the appropriate column. Or, depending on the size of your temp-table you may want to just populate the temp-table field you are displaying appropriately before you open the query.
 
Top