0

Compound filter for a view

Hi All,

I would like to do a compound filter in a view by using a date range and a dynamic multiple choice. That way I can filter for one or more customer sales within a given date range.

here is the code for the date range placed in the view formula field:

what can I add to this code to use the dynamic multiple choice field for customers?

let xStart := 'StartDate';
let xEnd := 'endDate';
select SALES where 'Sale Date' >= xStart and 'Sale Date' <= xEnd

Thanks for looking!

Sam

30 replies

null
    • Fred
    • 1 yr ago
    • Reported - view
     said:
    when you have a chance, please attach the small database showing how you handled the filter.

    here it is. Open the Quick View then go to the Tab tab.

      • Sam.1
      • 1 yr ago
      • Reported - view

       Works nicely with the customer and the reference field. However, I'm unable to filter with the dMC fields. Would that require the code that you sent prior in this Post?

      • Fred
      • 1 yr ago
      • Reported - view

      are you adding both dMC and reference? I thought you were moving away from dMC?

      Yes this post has the dMC solution, but no reference field.

      • Sam.1
      • 1 yr ago
      • Reported - view

       yes, I very much appreciate being able to use the reference for the Products. I was hoping to also have the dMC available as well so that it can represent an easy access to filtering for a list of favorites.

      I could do this with a switch or however you think it would best be facilitated.

    • Fred
    • 1 yr ago
    • Reported - view
     said:
    I was hoping to also have the dMC available as well so that it can represent an easy access to filtering for a list of favorites.
    I could do this with a switch or however you think it would best be facilitated.

    A switch would be my choice since you have 2 different fields to search on (with Customer being always used). You may want to do something like:

    let xDMC := if dMC then 1 end;
    let xProd := if Prod then 2 end;
    let xMode := xDMC + xProd;
    switch xMode do
    case 1:
    filter only on dMC
    case 2:
    filter only on Products
    case 3:
    filter on both dMC and Products
    default:
    filter only on Customer
    end
    

    Luckily it is only two fields that could be blank.

    If you had a third field then it would grow.

    let xDMC := if dMC then 1 end;
    let xProd := if Prod then 2 end;
    let xThird := if Third then 4 end;
    let xMode := xDMC + xProd + xThird;
    switch xMode do
    case 1:
    filter only on dMC
    case 2:
    filter only on Products
    case 3:
    filter on both dMC and Products
    case 4:
    
    case 5:
    
    case 6:
    
    case 7:
    
    default:
    filter only on Customer
    end
    

    If there is a fourth field then maybe someone has a better system.

      • Sam.1
      • 1 yr ago
      • Reported - view

      thanks for giving this your time. I'll let you know how it goes

Content aside

  • 1 yr agoLast active
  • 30Replies
  • 409Views
  • 3 Following