Enforcing Upper Case text in attribute

403
3
Jump to solution
08-19-2021 10:59 AM
Labels (2)
LorindaGilbert
Occasional Contributor II

Hi All,

Is there an attribute rule or a setting in the egdb that would enforce that all text entered in an attribute field would be upper case - no matter how it was typed?

Thanks,

Lorinda

0 Kudos
1 Solution

Accepted Solutions
JoeBorgione
MVP Esteemed Contributor

In the the first sequence you haven't done anything to the original value of  your variable 'cmts'.  You do in the second sequence. Very cool.

var cmts = $feature.Comments

var Uc = Upper(cmts)

return Uc;

Here I create a new variable and return it.  Not as cool. No need to create a variable because you use the object properties.

That should just about do it....

View solution in original post

0 Kudos
3 Replies
JoeBorgione
MVP Esteemed Contributor

In the code below, I concatenate a bunch of attributes and then use the proper() function to make the final text pretty.  Use the upper () function instead in line 12...

var values = [$feature.NAME, $feature.POSTTYPE, $feature.POSTDIR]
var combined_value = [];
// Loop through the field values and test if they are null or empty strings
// If they are not null or empty add them to an array
for (var i in values) {
    var value = values[i];
    if (IsEmpty(value)) continue;
    combined_value[Count(combined_value)] = value
}

// Return the field values concatenated with a space between
return proper(Concatenate(combined_value, " "));

 This fires on Insert and Update.

That should just about do it....
LorindaGilbert
Occasional Contributor II

Hi Joe,

This is the code that I used and published, but it wasn't giving me upper case text when I test in neither ArcPro nor in the web app.  I checked, the column name is proper name - Comments.

     var cmts = $feature.Comments

          Upper(cmts)

     return cmts;

So I changed it to be this:

     var cmts = $feature.Comments

     return Upper(cmts);

And it worked - go figure.

Thanks for the validation that I was using the correct item, just slightly wrong syntax.

Lorinda

0 Kudos
JoeBorgione
MVP Esteemed Contributor

In the the first sequence you haven't done anything to the original value of  your variable 'cmts'.  You do in the second sequence. Very cool.

var cmts = $feature.Comments

var Uc = Upper(cmts)

return Uc;

Here I create a new variable and return it.  Not as cool. No need to create a variable because you use the object properties.

That should just about do it....
0 Kudos