1 Reply Latest reply: May 11, 2017 6:33 AM by omar bensalem RSS

    How can i load or get all table columns in one field and...?

    s Walter

      Hi,

       

      i load a table like this


      ProductSalesSales TargetOnlineOnline Target
      Bananas12020080150
      Socks3001000200700

       

      Now i want to create a field where i can select:

      Show Sales

      Show Online


      In the dashboard i use this field and create a (only one) table wich should be dynamic:


      [Select Field] -> Show Sales is selected and shows


       

      ProductSalesSales Target
      Bananas120200
      Socks3001000


      [Select Field] -> Show Online is selected and shows


       

      ProductOnlineOnline Target
      Bananas80150
      Socks200700


      What is the best practice for this?


      I dont´t want to get the columnnames for a new field in a static manuell way, i prefer a dynamic one. Because the columns can change.

       

      I think i can use the data from the loaded table and put the fields to a new field like this?!

       

      Load
      Sales & Sales Target as Show Sales
      Online & Online Target as Show Online
      from resident...
      


      But is there a way that the names of the new fields are created automaticly according to a pattern?


      Load
      {columnnames with the same first word} as Show + {the first word before whitespace}
      from resident...
      

       

      So the script should load

       

      Product as Show Product

      Sales Target + Sales as Show Sales

      Online + Online Target as Show Online


      regards,

      sam

        • Re: How can i load or get all table columns in one field and...?
          omar bensalem

          Keep your table as it is, then add a new Inline table as follow:

           

          load * Inline [

          ShowID, Show

          1, ShowSales

          2, ShowOnline

          ];



          Now put your new Show field as a slection list :

           

           

          Now in your table have 3 dimensions :

          1) Product :

          2) =pick(ShowID, 'Sales ='&Sales, 'Online ='& Online) : name it Actual

          3) =pick(ShowID, 'Sales Target ='&[Sales Target], 'Online Target ='& [Online Target]) : name it Target

           

          And now dpends of your selection in the Show field, the result would be ;

          Capture.PNG

           

          Capture.PNG