Flowfield with company name as a filter

poppinspoppins Member Posts: 647
Hi everyone,

I have created a flowfield in the item table with the following calcformula:
Sum(MyTab.Quantity WHERE 
(
Item No.=FIELD(No.),
Status=FILTER(s1|s2),
Location Code=FIELD(Location Filter),
Requested Receipt Date=FIELD(Date Filter)
))
Since the table MyTab is shared between the companies (DataPerCompany=No) and there are some items that are shared between companies, I want to add another filter on the company name...
I tried to add the following line to the filter in the flowfield:
Company=FILTER(COMPANYNAME)
but it didn't work...

How can fiter on the current company name on a flowfield???

Thanks in advance :mrgreen:

Comments

  • lvanvugtlvanvugt Member Posts: 774
    What do you expect as a result (if the FlowField would have worked)? As the data in MyTab is shared between companies this FlowField should IMHO always return the same value irrespective of what company you're in. Unless ... MyTab contains a field/column that contains the company code/name. And if you have that field, then add that to your FlowField filter. 8)
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
  • poppinspoppins Member Posts: 647
    lvanvugt wrote:
    What do you expect as a result (if the FlowField would have worked)? As the data in MyTab is shared between companies this FlowField should IMHO always return the same value irrespective of what company you're in. Unless ... MyTab contains a field/column that contains the company code/name. And if you have that field, then add that to your FlowField filter. 8)
    Thank you for your answer...
    Infact, the data in MyTab is shared and the filed Company contains the company name from which the line was inserted...
    I want that my flowfield gives me the sum of the lines that belong to the company I am logged in...If I am in copm1, I want the flowfield to just consider the lines with Company=comp1...
    How to do so?
  • lvanvugtlvanvugt Member Posts: 774
    OK, sorry I misunderstood. Unfortunately you cannot use an expression like for example the system variable COMPANYNAME in a FlowField Table filter.
    i think you have tow options of solving this in NAV

    Option 1
    As you only have filter line of type FIELD, CONST or FILTER. In case of the latter two (CONST/FILTER) the value you provide needs to be a static value (and COMPANYNAME is no static). If you use the first (FIELD) you need to have a field with company name in both the source table (i.e. the table the FlowField is 'looking at') and target table (i.e. the table the FlowField is 'looking from'/defined on).

    Option 2
    You have to build a function that actually does what the FlowField you would like to have does and use this as the SourceExpr on the control on the page where you want to display the value.
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
  • FDickschatFDickschat Member Posts: 380
    Just create a Company Name Filter field in T27 and use that in your calc formula (similar to the Location Filter or Date Filter field)
    Frank Dickschat
    FD Consulting
  • lvanvugtlvanvugt Member Posts: 774
    FDickschat wrote:
    Just create a Company Name Filter field in T27 and use that in your calc formula (similar to the Location Filter or Date Filter field)

    Frank, indeed a valid option, that didn't come to my mind (which I am 'breaking' now that I haven't thought of it myself :shock:).
    But then you have to populate it, either manually (which I recon this is not what poppins is looking for) or by code using COMPANYNAME on the page(s) your are calling the FlowField from.
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
Sign In or Register to comment.