4 Replies Latest reply: May 8, 2012 3:14 AM by Misi Mladoniczky RSS

    Code help?

    Ravindra Babu Gudimallam

      Dear All,

       

      I have the below value in a Character field “Detailed Description”.

       

      BusinessJustification:

      Business

      ____________________________________

       

      CorporateID : 18995

      FullName         : Nabeel Kazem MansourAlmarhoon

      Email                 : marhoonnk@sabic.com

      AccountTransfer From  : SABJUBIAL

      Account Transfer To      : SANHADEED

       

      Now I am trying to take the Corporate ID and do set field into anothercharacter field. Below is the code I wrote ,


      RTRIM(SUBSTRC($Detailed Description$, STRSTRC($DetailedDescription$, "Corporate ID : ") + 15, STRSTRC($DetailedDescription$, "Corporate ID : ") + 22))

       

      but the result is as below.

       

      18995

      F

       

      I think, instead of 22 I need to write some functions.

      Can anyone please help me in getting only Corporate ID . FYI, there is one  blank space after corporate ID "18995_".

       

      Thanks & regards

      Ravindra

        • 1. Code help?
          Ravindra Babu Gudimallam

          Some how I got what I am looking with the below.but just a workaround.

           

          Set Field 1:

          Temp_RequestedFor = RTRIM(SUBSTRC($Detailed Description$, STRSTRC($Detailed Description$, "Corporate ID : ") + 15, STRSTRC($Detailed Description$, "Corporate ID : ") + 22))

          Set Field 1:

          Temp_RequestedFor =SUBSTRC($Temp_RequestedFor$, 0, STRSTRC($Temp_RequestedFor$, " ") - 1)

           

          Please help me for single set field action.

           

          Thanks & regards

          Ravindra

          • 2. Code help?
            Misi Mladoniczky

            Hi,

             

            How long is the Corporate Id? Is it numeric only, or does it contain characters? It seems that you are doing a lot of "trimming", maybe the number is manually entered?

             

            In any event, if it is exactly 15 characters and starts after "Corporate ID : ", this should do it:

            result = LEFTC(SUBSTRC($Descr$, STRSTRC($Descr$, "Corporate ID : ") + LENGTH("Corporate ID : ")), 15)

             

                    Best Regards - Misi, RRR AB, http://rrr.se

            • 3. Code help?
              Carl Wilson

              Hi,

              why not use the second field "FullName" as a reference to the position for the end of the CorporateID?:

               

              E.g.

               

              RTRIM(

              SUBSTRC($Detailed Description$,

              STRSTRC($DetailedDescription$, "Corporate ID : ") + 15,

              STRSTRC($DetailedDescription$, "Full Name") - 1)

              )

               

               

              Cheers

              Carl

               

              http://www.missingpiecessoftware.com/

              • 4. Code help?
                Misi Mladoniczky

                Hi,

                 

                This one would be even simpler

                 

                TRUNC(

                  SUBSTRC($Detailed Description$,

                    STRSTRC($Detailed Description$, "Corporate ID : ") + 15

                  )

                )

                 

                        Best Regards - Misi, RRR AB, http://rrr.se