Type Conversion

brianbernard191brianbernard191 Member Posts: 19
Type conversion is not possible because one of the operators contains an invalid type.

I have been trying to simply add two variables of type integer and display the result in a pop up window using MESSAGE function.
op1 := 10;
op2 := 20;
op1 := op1 + op2;
MESSAGE(op1);

This is the code segment. The type of variables op1 and op2 is defined as INTEGER.

Comments

  • KishormKishorm Member Posts: 921
    edited 2016-10-05
    Try...
    MESSAGE('%1',op1);
    
    ...messages always have to be text, so you need to convert the Integer (op1) to text. You could also have used....
    MESSAGE(FORMAT(op1));
    
  • brianbernard191brianbernard191 Member Posts: 19
    edited 2016-10-05
    @Kishorm Thank you !! It worked.
  • KishormKishorm Member Posts: 921
    No problem!

    P.S. You should mark the post as "Solved" so a tick appears against the post and others can see that it's already been resolved
  • brianbernard191brianbernard191 Member Posts: 19
    @Kishorm : How can I mark a post as solved? I couldn't find any option for that. I am completely new with mibuso.
  • KishormKishorm Member Posts: 921
    Try...

    1. Go back to the Origin of the thread.
    2. Click on "Edit" button.
    3. Attribute field will appear with drop-down default value "None".
    4. Select "Solved" form the drop-down and Submit.
  • brianbernard191brianbernard191 Member Posts: 19
    @Kishorm: I couldn't find an attribute drop down in the edit page. :(
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    I hope that EDIT suggestion was for old site.
    for new site...didn't you find "Did this answer the question YES or NO" option under the replies?
  • KishormKishorm Member Posts: 921
    edited 2016-10-05
    Oops, I just searched for the answer to this as I haven't posted a question in years so haven't had the chance to do it myself and didn't realise this related to the old site. Hopefully, Mohana's reply on this will prove to be a little more useful :)
Sign In or Register to comment.