0

How can I adjust this?

In the Home table, I selected the Alcohol option. The three charts below show the corresponding values. Starting from the second chart, I added the condition (choose=2). In the third chart, I added the condition (choose=2 or choose=1). However, this caused an error, and the chart values started to be displayed incorrectly. Thank you for your reply.

5 replies

null
    • Fred
    • 2 mths ago
    • Reported - view

    If you put the following code in a new formula field:

    let s := this;
    let y := for loop1 in numbers(xxx) do
            record('copy here',loop1).name
        end;
    let x := (select 'copy here'
            where (var n := name;
            count(y[= n]) > 0));
    let z := (select 'copy here'
            where (var n := name;
                count(y[= n]) > 0) and
            number(choose) = 2);
    let w := (select 'copy here'
            where (var n := name;
                    count(y[= n]) > 0) and
                number(choose) = 2 or
            number(choose) = 1);
    debugValueInfo(z) + " - " + debugValueInfo(x) + " - " + debugValueInfo(w)
    

    You will see that you are getting the correct results from your filtering. "x" is your first code, "z" is when you set choose = 2, and "w" is when you have choose = 2 or choose = 1. You will see nid and if you go back to your copy here table you will see that the correct records are selected.

      • gold_cat
      • 2 mths ago
      • Reported - view

       

      I don't quite understand Fred. My initial selection was "Alcohol". The final table includes "beverage", which should be incorrect.

      • gold_cat
      • 2 mths ago
      • Reported - view

       

      Even after I deselect (xxx), the (choose=2 or choose=1) chart still has results. What is the problem here?

      • Fred
      • 2 mths ago
      • Reported - view
       said:
      I don't quite understand Fred. My initial selection was "Alcohol". The final table includes "beverage", which should be incorrect.

       I don't see beverage unless I select beverage.

       said:
      Even after I deselect (xxx), the (choose=2 or choose=1) chart still has results. What is the problem here?

       It is all in how you ask to filter. The code is written:

      select 'copy here'
          where (var n := name;
              count(y[= n]) > 0) and
          number(choose) = 2 or number(choose) = 1
      

      filter records that match a selection in the xxx dMC and records (regardless if the first filter is true) that have a choose = 2 or choose = 1.

      if you put a ( ) around the choose part then it forces Ninox to find both conditions.

      select 'copy here'
          where (var n := name;
              count(y[= n]) > 0) and
          (number(choose) = 2 or number(choose) = 1)
      
      • gold_cat
      • 2 mths ago
      • Reported - view

       

      You are so knowledgeable. 👍

Content aside

  • Status Answered
  • 2 mths agoLast active
  • 5Replies
  • 40Views
  • 2 Following