4 Replies Latest reply: May 15, 2014 9:51 AM by starpower _ RSS

    trouble with funktion(s)

      Hi together,

       

      I really got mad about errormessages about a small funktion like this:

       

      If(substr[resnr],1,1)="2";"Yes";"No")

       

      Monarch 6.01 tell`s me: wrong operand, not correct splitter ... The helpfile don`t give any "help" and it seems to be correct.

       

      Regards

      Rolf

        • trouble with funktion(s)
          Nick Osdale-Popa

          You're missing a "(":

          [font="courier"]right here

                   |

                   V

          If(substr(,1,1)="2";"Yes";"No")[/font][/quote]However, if resnr is a numeric field try this:

          [font="courier"]If(substr(Trim(str(,255,2)),1,1)="2";"Yes";"No")[/font][/quote]

           

          [size="1"][ April 01, 2004, 08:57 PM: Message edited by: Nick Osdale-Popa ][/size]

          • trouble with funktion(s)

            Hi Nick,

             

            thank you for your reply, what i don`t understand

            after correct the first function Monarch tells me again "Operandentypen"(German) and the cursors stands here:

             

            If(|  

                

            If(substr(,1,1)="2";"Yes";"No"),

             

            the 2nd funktion from you works.

            Do you can help me, understanding the errormessage ?

            Is it mayby the resnr(numeric) is a 7digits filed and there are only 6 digits in starting from the right ?

             

            Thanks for your help so far.

             

            Regards

            Rolf

            • trouble with funktion(s)
              Nick Osdale-Popa

              Your original function would not work properly because, as you stated, resnr[/b] is a numeric field and you are trying to use a string/text function on that number -which causes the Operand Error.  You first need to convert resnr[/b] to a string using the STR() function, then you can apply the SUBSTR() function accordingly.

               

              The STR() format is such:

              STR(FIELD,CHARS,DECIMAL,FILL)

              Field = Field you want to convert

              Chars = number of characters you want to return

              Decimal = number of decimals you want to include from your number

              Fill = character use to fill in the extra place holders from your number.

               

              My STR() function:

               

              str(,255,2))

               

              Returns resnr[/b] with 2 decimals of 255 characters filled in with spaces.

              The TRIM() function elimanates all the extra spaces.

              I don't know if resnr[/b] contained any decimals, so I used a standard of 2. Also, not knowing the actual length of the field, I used the maximum number of characters to be sure everything was included, otherwise your field may have been truncated.

               

              After resnr[/b] is converted to a string, the original IF(SUBSTR()) function works properly.

               

              Hope that explains the process!    [img]smile.gif[/img]

               

              [size="1"][ April 04, 2004, 04:47 AM: Message edited by: Nick Osdale-Popa ][/size]

              • trouble with funktion(s)

                Hi Nick,

                 

                thank you for your help. I must be blind, to string a numeric field.  :mad: 

                Regards

                Rolf