3 Replies Latest reply: May 20, 2016 10:49 AM by Stefan Wühl RSS

    How to retrieve all values which have the left(value, n) in common with the selection

    Jérémy Bonde

      Hello, it's quite hard for me to explain :
      I need to retrieve all childrens and all parents of my selected value. Suppose a table like this :

       

      IDTest1IDTest2
      01#elem1
      01#01#elem2
      01#02#elem3
      01#02#01#elem2
      01#02#02#elem4


      I would like to know all parents of elem3 (elem1) and all his children (elem2 and elem4). My only way to know it is the IDTest1 which one contains all the parents of an IDTest2. IDTest2 is not unique because it can be used by many IDTest2. The IDTest1 is unique.

       

      So I would like, from a selection of the IDTest2 retreive all the IDTest2 used by the selected and all the IDTest2 which use the selected value.

       

      I really don't know how to proceed. Even if I take the selected value, how can I retrieve all IDTest2 which have the left part of IDTest1 in common with the selected one ?

       

      Thanks

       

      EDIT : I tried by data load but I didnt find a way to avoid two loops (one for each IDTest2 and the second (nested in the first one) for each IDTest1 corresponding to the IDTest2 and that really took too much time....

       

      I tried many things by measure expression but for now, I m not good enough and need your help . To simplify my objective I only had to select the IDTest1 (the final objective is to get the same result by focusing the IDTest2) and I tried this kind of things :

      if(left([IDTest1], len(getfieldselections([IDTest1])) - 3)  = getfieldselections([IDTest1]), IDTest2)
      I also tried many things like  count({1} if(left([IDTest1], len(getfieldselections([IDTest1])) - 3)  = getfieldselections([IDTest1]), IDTest2)) to avoid the range of my selection and try to get something but ... no result !

       

      I hope my english is understandable

       

      Ce message a été modifié par : Jérémy Bonde