Jump to content

Call out text resource based on character length?


rpaterick

Recommended Posts

I have text flow issue with short name and long name inputs in the data file.

 

How can I call out a text resource based on character length?

 

Also, how could I call out a "page" based on character length also(just in-case)?

 

The character length is 7 characters, for the breaking point.

 

Thanks!:D

Link to comment
Share on other sites

Something like this:

if (Field("YourFieldName").length > 7)
   return Resource("ResourceForLongNames");
// else
return Resource("ResourceForShortNames");

Or, more succinctly:

return Resource(Field("YourFieldName").length > 7 ? "ResourceForLongNames" : "ResourceForShortNames");

If you want to call out a completely different page, you could do something like this in OnRecordStart:

if (Field("YourFieldName").length > 7)
   FusionPro.Composition.SetBodyPageUsage("PageForLongNames", true);
else
   FusionPro.Composition.SetBodyPageUsage("ResourceForShortNames", true);

Also, I feel compelled to say that, unless you're using a fixed-width font, just knowing the number of characters doesn't really tell you whether something will fit somewhere or not. The only way to know for sure how much space some text will take up is to measure it with the FusionProTextMeasure object. Furthermore, you can probably accomplish what you need with some kind of copyfitting instead of calling out completely different resources or pages.

Link to comment
Share on other sites

Furthermore, you can probably accomplish what you need with some kind of copyfitting instead of calling out completely different resources or pages.

 

The marketing designer has dictated how they want the smaller number of characters to break(paragraph) and longer characters to break.

 

I did the "Len" formula in excel and then sorted to see where the breaking(text flow) issue for them is occurring, that they didn't like the text wrapping.

 

Thanks Dan for your help this is very appreciated! :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...