SQL Expression to Populate String Field

471
5
Jump to solution
10-09-2021 04:51 PM
ScottFraser-KeyWest
New Contributor II

Can’t remember what the syntax is when using Field Calculator with SQL to populate a string field. I’m just trying to populate a field with the word “Yes” but enclosing that word within single or double quotes throws an error.

I remember the solution was simple when I last did this a couple of years ago, just not simple enough for me to recall.

0 Kudos
1 Solution

Accepted Solutions
DavidPike
MVP Frequent Contributor

You don't need to select the field, that's only if you want to reference the current field or other fields in your code block.

from your screenshot it looks like you have directional single quotes (unsure if this is just the case of the ipad post-formatting them).  I recon it doesn't understand this unicode character.  Try to find the straight single quote on your keypad 'Yes' or:

This article seems to have the fix How to Type Straight Quotes on iPad (osxdaily.com)

View solution in original post

0 Kudos
5 Replies
DavidPike
MVP Frequent Contributor

Should be as you described.  You sure your field type is Text/String? 'Yes' single quotes should be doing the trick.

0 Kudos
ScottFraser-KeyWest
New Contributor II

 

I thought so, but getting an error. Maybe because I’m trying to do this from home on an iPad. I’ll try again tomorrow from a real computer. 

A25513C2-EABC-42F3-A823-42CC033056B5.jpeg

0 Kudos
ScottFraser-KeyWest
New Contributor II

It might simply be that I need to select the field from the left column, and not all the fields are showing on my iPad without an ability to scroll down. 

0 Kudos
DavidPike
MVP Frequent Contributor

You don't need to select the field, that's only if you want to reference the current field or other fields in your code block.

from your screenshot it looks like you have directional single quotes (unsure if this is just the case of the ipad post-formatting them).  I recon it doesn't understand this unicode character.  Try to find the straight single quote on your keypad 'Yes' or:

This article seems to have the fix How to Type Straight Quotes on iPad (osxdaily.com)

0 Kudos
ScottFraser-KeyWest
New Contributor II

Yup, that was the problem.  Thanks David.