Jump to content
Server Maintenance This Week. ×

Auto Validate based on number of text lines.


This topic is 5715 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have the attached field that I need to run a few calculations of off to validate the size of the field.

I have a calculation set to calculate the size of various characters and present a total size of "Character Units" used. A character unit representing the size of a lower case character (Upper case = 1.304113 units, commas and periods, etc = 0.5454545 units based on the font I use)

My goal is to validate based on 2 criteria: Character Unit count and number of text lines.

The field can not be more than 300 characters, and no more than 10 lines of text (not all lines will have full 30 characters, and some will be have carriage returns to break the line).

I have a attached two files to show basically what the ad could look like.

Let me know if you need more explaination. I appreciate any help.

AdCopy_Field.jpg

AdCopy2_Field.jpg

Link to comment
Share on other sites

Hmmm, an interesting problem. Perhaps this might help with the character unit count:

Length( Filter( field ; "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) ) * 1.304113 +

Length( Filter( field ; ",.;:'!" ) ) * 0.5454545 +

Length( Filter( field ; "abcdefghijklmnopqrstuvwxyz" ) ) * 1.0

You'd have to exhaustive with the characters inside the quoted text to ensure they're all there otherwise they won;t get counted.

Link to comment
Share on other sites

  • 1 year later...

I had thought a little about a 10 row portal. But from a user perspective, that would be a pain to manuver around. Especially since, FM doesn't validate until the field is exited.

It is just too much tabbing around to make a nice functional solution.

Although I am open to suggestions if anyone knows a way to handle that is user friendly...

I might be able to use the web viewer to enter into a HTML form field. I suppose that way you could have the field stop accepting text once you fill the text box... But I just don't have the skills yet to make it actually work.

Link to comment
Share on other sites

The result of the function:

GetLayoutObjectAttribute ( "ObjectName" ; "height" )

is very different in version 9, because it depends by the "anchors" of the object.

I think that this file will show it to you...

BTW: the calculation is platform dependent, so mac users may need to fine tuning it.

Count_field__s_rows.zip

Link to comment
Share on other sites

The default anchors are two, say:

Nord and Ovest

GetLayoutObjectAttribute ( "ObjectName" ; "height" ) returns the exact height of the field

BUT

if you ADD the SUD anchor,

GetLayoutObjectAttribute ( "ObjectName" ; "height" ) returns the height of the field when selected and the result is different if the field contains one, two or more rows.

This is why the script has the step:

Go To Field

Try to put a Pause and a Show Custom Dialog with that function or to see the Data Viewer.

Link to comment
Share on other sites

When you go to the field, the field stretches to show the full content (if necessary). This happens regardless of the anchors. Your script works the same if you uncheck the "south" anchor.

On the contrary, checking the "south" anchor can defeat the script because if user has enlarged the window, the field boundaries will stretch downward, regardless of the field's content.

Link to comment
Share on other sites

Your script works the same if you uncheck the "south" anchor.

Yes, you are right... only now I see it.

But that wasn't the case with version before 9 ( or so I seem to remember and now I can't check ) and, from FileMaker site:

GetLayoutObjectAttribute function

...

Notes

1) If objects are set to auto-resize, attributes returned are based on the resized bounds of the object in its current state.

Link to comment
Share on other sites

No, and it won't wash your car either.

:bang: Man, I was hoping, too!!! :therethere:

Well, its not going to work as is. But gets me moving in the right direction.

Fortunately, the field I need the calc for will never change font size. So at least I have one less variable to account for.

I'll be back after I bash my head on the wall for a bit trying to get it to work!! :cofeebrake:

Link to comment
Share on other sites

The result of the function:

GetLayoutObjectAttribute ( "ObjectName" ; "height" )

is very different in version 9, because it depends by the "anchors" of the object.

I think that this file will show it to you...

BTW: the calculation is platform dependent, so mac users may need to fine tuning it.

In looking at the file, I was getting the wrong numbers with the South anchor checked. If I uncheck the South anchor is gives me the right number. (But, only works correctly with the Font and Size you had set)

Thinking a combination of the 2 ideas might work... :pounce:

Link to comment
Share on other sites

This topic is 5715 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.