2 Replies Latest reply: Mar 13, 2018 11:24 AM by Digvijay Singh RSS

    Script Load Count + add new inline table

    Gernot Bauer

      Hi everybody,

       

      i got this

       

      LS:

      SQL SELECT

          ARTIKELNR,

          "KRIT_TORQ_MIN",

          "KRIT_TORQ_MAX",

          "CHK_DREHMOMENT",

          "CHK_SCHRAUBEN",

          "CHK_MONTSCHR_OB",

          "CHK_MONTSCHR_UN",

          "CHK_LOCKSTIFT",

          "CHK_RIEGEL",

          "CHK_FEDER"

      FROM "PrfDat_ENTW".dbo."schalterprf_LS_agg1;

       

       

      Now i wanna create a new inline Table and Count if the content is 1. I tried like this:

       

      ERROR:

      Load Count(CHK_SCHRAUBEN = 1) as Anschr;

      Load Count(CHK_MONTSCHR_OB = 1) as Montschr_Oben;

      Load Count(CHK_MONTSCHR_UN = 1) as Montschr_Unten;

      Load Count(CHK_RIEGEL = 1) as Riegel;

      Load Count(IF(CHK_RIEGEL = 0 and CHK_FEDER = 1,1,0)) as Feder;

      Load Count(IF (CHK_DREHMOMENT <KRIT_TORQ_MIN or CHK_DREHMOMENT>KRIT_TORQ_MAX, 1, 0)) as Drehmoment

       

      Resident LS;

       

       

      grateful for any help!

        • Re: Script Load Count + add new inline table
          Sasidhar Parupudi

          Load Count(CHK_SCHRAUBEN = 1) as Anschr,

           

           

          Count(CHK_MONTSCHR_OB = 1) as Montschr_Oben;

          Count(CHK_MONTSCHR_UN = 1) as Montschr_Unten,

          Count(CHK_RIEGEL = 1) as Riegel,

          Count(IF (CHK_RIEGEL = 1, 0,1)) as Feder,

          Count(IF (CHK_DREHMOMENT <KRIT_TORQ_MIN or CHK_DREHMOMENT>KRIT_TORQ_MAX, 1, 0)) as Drehmoment

           

           

           

           

           

          Resident LS;

          • Re: Script Load Count + add new inline table
            Digvijay Singh

            I don't think you need so many preceding load, you may need to try something like this, all the fields which are not used in the Count function should be treated as dimension against which you are aggregating and counting your values.


            ERROR:

            Load

                           Count(IF(CHK_SCHRAUBEN = 1,0,1)) as Anschr;

                           Count(F(CHK_MONTSCHR_OB = 1,0,1)) as Montschr_Oben;

                           Count(IF(CHK_MONTSCHR_UN = 1,0,1)) as Montschr_Unten;

                           Count(IF(CHK_RIEGEL = 1,0,1)) as Riegel;

                           Count(IF (CHK_FEDER = 1, 0,1)) as Feder;

                           Count(IF (CHK_DREHMOMENT <KRIT_TORQ_MIN or CHK_DREHMOMENT>KRIT_TORQ_MAX, 1,                0)) as Drehmoment

             

            Resident LS

            Group by ARTIKELNR,CHK_LOCKSTIFT ;