2 Replies Latest reply on Jan 13, 2014 11:45 AM by B_1

    Button assigns numerical value instead of text

    B_1

      Title

      Button assigns numerical value instead of text

      Post

           When clicking out button, it performs a script to SetField to many different fields with text only data. The fields are set to text data, as well as the calculation set to a result in a text value and there are also no numerical data in the calculations. However, upon pressing the button, all fields are set to either the 0(zero) or 1. 

            

           Any ideas?

        • 1. Re: Button assigns numerical value instead of text
          philmodjunk

               The calculated result entry is probably set up as a Boolean expression that evaluates to True (1) or False ( 0 ) and thus you are setting the field to a number instead of text.

               To set a field to "Apple", the script step should look like this:

               Set Field [YourTable::YourTextField ; "Apple" ]

               if you used:

               Set Field [YourTable::YourTextField ; YourTable::YourTextField = "Apple" ]

               You have that Boolean expression and will be setting the field to either 1 or 0.

               If that does not resolve this issue, please post your script.

               To post a script to the forum:

                 
          1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
          2.      
          3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
          4.      
          5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
          6.      
          7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
          • 2. Re: Button assigns numerical value instead of text
            B_1

                 Found out what was going wrong right before I read this.

                  

                 What happened was when specifying target field, I would select the appropriate field. Then when specifying the calculated result of this field, I would once again choose the appropriate field. That is where the coding went wrong and caused the output of numerical value. So we deleted the second specification of the field, and in the calculated result specification, we just typed in the result. 

                  

                 Thanks Phil