Manually correcting a problematic custom field name

6 views
Skip to first unread message

bruce_...@sil.org

unread,
Aug 26, 2016, 4:56:17 PM8/26/16
to flex...@googlegroups.com

The short version of my question is: Will I create problems with S/R, project history, or some other operation of the FW database if I manually edit the file “FlexProject.CustomProperties” in my project folder in order to fix a custom field name?

 

I realize there’s probably a better way to fix this or some other consequences I’m not aware of, so here are a few more details:

 

I’ve been trying to add my FW database as a data source for a Phonology Assistant (3.5.4) project. When PA tries to load the data it crashes to the green error report dialogue. I’ve suspected that this may be related to a problematic custom field name that has persisted somewhere in the database even though I have changed it through the Custom Fields interface.

 

One of the clues that makes me think the custom field name is the culprit is a warning that pops up every time I launch an export function: immediately after choosing “Export” from the File menu I’m shown a warning box titled “Punctuation in custom field name” with the message “The custom field name “CustomField-Sense” includes punctuation characters. This may cause export to fail or make the exported file difficult for other programs to use. We recommend that you rename your custom filed and then do the export again.”

 

I don’t remember ever having made a custom field with that name, but it’s not unlikely that I could have done so for experimenting with something and then changed its name later. In any case, none of my custom fields, as they are currently displayed in the interface accessed through Tools > Configure > Custom Fields, currently have that name.

 

When I ran the FlexTools “Database Information” report module against my project it reported the same custom field names that the FW interface displays. Running the “Find and fix errors…” utility in FW didn’t offer any clues, either. I was able to track down the offending field, though, by performing a “Full Lexicon” Lift XML export of the project and then importing the Lift file into a new blank project. In the new project, the Custom Fields interface displays one of the custom field names as “CustomField-Sense” instead of the name “Descriptive Definition” that I had changed it to in the original project.

 

I found that one of the <CustomField> elements in the project’s FLExProject.CustomProperties file includes a “label” attribute with the value “Descriptive Definition” (corresponding to what is displayed in the FW interface), but a “name” attribute with the value “CustomField-Sense”. None of the other <CustomField> elements contain a “label” attribute; all their “name” attributes correspond to what is displayed in the FW interface.

 

Can I safely manually remove the “label” attribute from the offending element in that file and replace the value of its “name” attribute with the correct contents?

 

Thanks,

Bruce

 

Sent from Mail for Windows 10

 

Randy Regnier

unread,
Aug 26, 2016, 5:35:40 PM8/26/16
to flex...@googlegroups.com

On 8/26/2016 1:56 PM, bruce_...@sil.org wrote:

The short version of my question is: Will I create problems with S/R, project history, or some other operation of the FW database if I manually edit the file “FlexProject.CustomProperties” in my project folder in order to fix a custom field name?

 

 Can I safely manually remove the “label” attribute from the offending element in that file and replace the value of its “name” attribute with the correct contents?

In a word: "no".

It is safe enough, but manual edits to the “FlexProject.CustomProperties” file won't accomplish what you are trying to do, since FLEx doesn't read that file. That file is deleted and recreated by Flex Bridge each time a full project S/R is done (along with a gazillion other S/R files, BTW), so any manual edits you do to it will be lost.

The best way to change it is to edit the custom field definition in FW, it that is allowed. The second best way to fix it would be to very carefully edit your main fwdata file. (You will copy the entire project folder to a nice safe place first outside of that same FW Projects folder, right?) ;-) At the top of that fwdata file, you will see your custom fields definitions. You should be able to edit the name there. BUT, you will also need to change all places in the rest of the fwdata file that use that custom field to the new name.

To use your partial custom field information, for example:

1. At the top change this:

<CustomField ..... name="CustomField-Sense" .... />

to this (to get rid of the hyphen):

<CustomField ..... name="CustomFieldSense" .... />

You can't really put the label attribute value into the name attribute, since the label can be anything, but the name must be more machine friendly. IIRC, Flex skips adding the label attribute if the name is both user friendly and machine friendly, but it adds the label attribute, if it isn't suitable for use by the computer. It then creates what is supposed to be a machine friendly name, but you may have run into a bug.

2. Throughout the remainder of the fwdata file:

Wherever you see: <Custom name="CustomField-Sense"...

Remove the hyphen, so it matches the name at the top.

Fire up Flex and see if that pesky warning message goes away. If you still see it, you may as go the safer route and zap that folder and move your copied folder back into its place.

Randy

ann_...@sil.org

unread,
Aug 26, 2016, 10:04:47 PM8/26/16
to flex...@googlegroups.com

Hi Bruce,

 

You shouldn’t edit this file, but edit the project.fwdata file directly.  The custom fields are listed near the top of the file. so should be easy to find.  It is a good idea to backup this file before you change it in case something goes wrong.  Also don’t try to change it if FLEx is open.

 

Ann

--
You are subscribed to the publicly accessible group "FLEx list".
Only members can post but anyone can view messages on the website.
---
You received this message because you are subscribed to the Google Groups "FLEx list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flex-list+...@googlegroups.com.
To post to this group, send email to flex...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flex-list/57c0acee.021f9d0a.251c2.6c0c%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.

Bruce Beatham

unread,
Aug 27, 2016, 4:18:04 PM8/27/16
to flex...@googlegroups.com
On 8/26/2016 4:35 PM, Randy Regnier wrote:
> The best way to change it is to edit the custom field definition in
> FW, it that is allowed. The second best way to fix it would be to very
> carefully edit your main fwdata file.

Thanks Randy & Ann for pointing me to the location of the custom field
info in the fwdata file. I re-checked the custom field names from inside
FW (Tools > Configure > Custom Fields), but nothing there showed the
name "CustomField-Sense" that I could edit. So I tried the "second best"
way and changed all occurrences of that name to match the value of the
label attribute (in this case "Descriptive Definition"); when I fired up
FW again everything was fine, and there was no error message when I
launched the export command.

Unfortunately, PA still didn't like my fwdata file. So, it finally
occurred to me to try a variation on Randy's 'best method' and attack
the custom fields from within FW. I made new custom fields with the
safest, shortest names I could and then used bulk edit to move all the
contents from the old custom fields to the new ones. Finally, I wiped
out all the old custom fields in FW. Now PA is happy with my fwdata
file, but I have a bit of tweaking to do to put the new custom fields
where they belong in the dictionary configuration.

Thanks again for your help,

Bruce

Reply all
Reply to author
Forward
0 new messages