Hard to understand exactly what you are describing without a screenshot. Can you use a merge field, and/or sliding left, sliding up options?
You have two problems:
- You can't dynamically specify the width of a field in FileMaker
- Length counts characters and that won't tell you the width that you need since different characters have different widths. Compare these two 5 character strings: iiiii WWWWW.
What you can do, in some circumstances, is to either make the field wider than you ever expect to need and set it to "slide left". This change is only visible when you print, PDF or preview the layout. Or you can insert it into a layout as merge text and then the field can expand as needed out to the width of the text object into which you inserted the merge field.
Key facts about sliding layout objects:
- It's only visible in preview mode and when you print/save as PDF...
- Sliding fields will shrink but not expand.
- All layout objects below and in the same layout part as the slide/resize field need to also be set to slide up and resize.
- Objects in headers and footers will not slide.
- Portals will shrink/slide to fit the number of rows of records, but fields within the portal row will not shrink/slide.
- Fields will slide up only if Top alignment is specified for it and will slide left only if Left alignment is specified.
- Consistent side borders are difficult to achieve with sliding fields.
- In FMP13, hidden objects (”Hide object when”) will slide/resize.