Names Field

I have a form where there is a names field. I imported alot of names to this form however I need them in canonicalized format. So far I have been going into each document and manually performing the lookup on the name. I know this can be scripted but can not remember how.

Subject: Names Field

Not quite sure what you are trying to do but have a look at computewithform()

Shawn

Subject: RE: Names Field

Its not a computed field. This is a names field set to lookup on the address book. If I go into these documents one by one in edit mode and hit enter at the end of the field after the contents imported it performs the lookup. I however do not wish to do this on over 2000 documents :slight_smile:

Subject: RE: Names Field

Assume field is called 'ANameField’Place the following in an agent set to run on all selected docs. and as the string player said, viola!!

FIELD ANameField := ANameField;

@if(

   ANameField != ""; 

          @SetField("ANameField"; @name( [CN]; ANameField);

   ""

 );

Subject: RE: Names Field

Unfortunately no viola could be heard. Am tring to get the CN= value so I had to change the @name([CN] value but to no avail

Subject: RE: Names Field

OK, I think i missed something in my last post but may now have it … or not :slight_smile:

You have created some docs, probably programtically.

They use a lookup to get a name placed in a names field.

If the document is opened and refreshed that will populate the names field correctly.

You don’t want to do that to 2000 docs.

Last post my suggestion was to take an exisiting name and make it a common name using the @username( [CN] fieldName ) formula but as no name exisits until the doc is refreshed this wont work.

However if the name exists and you need it to look like CN=jo OU=Acme … then @name( [CANONICALIZE]; NameField) would work for you by taking a shortened name and expanding it to a full canonicalized form. …

However if a lookup needs to be done to get the name and the formula is in the validation, computed values, translation or similar part of the form the following will execute all formulas on the form just like opening and refreshing the form.

Try this formula in an agent

It is the equivalent of computeWithform but stronger (IMHO)

Make the agent work on all docs selected or in a view or what ever it takes to get the docs that need doing.

@Command( [ToolsRefreshAllDocs] );

@All

Should that succeed then changing the name in the names field any other extra formating can be done can be done using the previous @names formula or similar. Look up @names in the dev help file for al options.