Message Boards

restrict a browse with a calculated field

David Langschied, modified 3 Years ago.

restrict a browse with a calculated field

Post Date: 12/18/19 (Silver, 61 Posts) Recent Posts

I have a field that is calculated in my browse.  I am using a function to calculate the inventory in specified locations.  I do not want to report lines that have a value of 0.  I tried to do so by naming the variable in the filter and it errored.  It looks like a can only filter by databas table fields.  Is there a way to handle this?

 

Francis Malengier, modified 6 Years ago.

Re: restrict a browse with a calculated field

Post Date: 1/1/20 (Bronze, 13 Posts) Recent Posts

Hi ,

 

some time ago i had the same requirement, I wanted a list of the items that have no stock.

I found the following trick :

In the local variables I added this piece of code :

pt_mstr is the table that is in my browse.

on find of pt_mstr do:
  find first in_mstr no-lock where in_domain = pt_domain and in_part = pt_part and (in_qty_oh > 0  OR  in_qty_nonet > 0) no-error.
  if available in_mstr then return Error.

  Init (pt_part).
end.

 

it is the 'return error' that does the trick. If you put that in an on find block of your table in the browse, it will skip that line.

the init function is the function I made to do my calculations of some calaculated columns.

I hope this can help you,

kr,

Francis

 

David Langschied, modified 6 Years ago.

Re: restrict a browse with a calculated field

Post Date: 1/2/20 (Silver, 61 Posts) Recent Posts

Thanks this a good thing to put into my pocket!

 

Franccy Van Weezel, modified 6 Years ago.

Re: restrict a browse with a calculated field

Post Date: 2/17/20 (Silver, 34 Posts) Recent Posts

Sorry, is very interesting your way. Do you have any chance to share function "init".

Thanks.

Ian Xie, modified 1 Year ago.

RE: restrict a browse with a calculated field

Post Date: 1/22/25 (Bronze, 1 Post) Recent Posts
Bingo! You helped me solve a big trouble.

Message place holder