Jump to content

Limit characters in a field


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

Recommended Posts

  • Newbies

I have searched but can not find how to limit characters in a field.

I have text fields (example: name or address) that need to be limited to about 30 characters. I have set the characters limits to 30 (it did nothing) I then added a "Validate by Calculation" setting the length to 30 (Length(My Field) >= 30). That did make it so that when your finshed entering (any anount of characters you want) it will pop up a window saying your beyond the limits of the field (but you don't know that limit until after your all done entering too much text.

But what I need it to do is this: Stop the curser at the limit of 30 characters. The person entering text should not be able to enter more than the 30 character limit.

How do I accomplish this?

Link to comment
Share on other sites

You could use a mono font, and size the field to 30 characters. That way they will see the field limit. I would also use the Validation for length, with the display message option.

HTH

Lee

Link to comment
Share on other sites

  • 4 years later...

Could the calculated option be applied to the TEXT field:   Left(text_field , 30)

 

Regardless of the number of characters typed, would this not leave only the left 30, or whatever limit you want.

Link to comment
Share on other sites

If you have FileMaker 10+ you could use an OnObjectModify script trigger on the field.

 

The script can easily determine the current character count in the field and determine whether to continue editing or not. This does not require the field to be exited or the record committed.

  • Like 1
Link to comment
Share on other sites

How about when you are printing?

Since FMP does not shrink portal rows when printing, could I place a one-line portal on a printout and limit the character count x number of characters thereby forcing any excess characters into the next portal row?

Hi ProTour !

In general, one should print from the 'portal' table. Are you aware that you can set fields to 'reduce or expand' (although that wording in v12 is incorrect because it only reduces)? Field height can adjust down if you make the field tall enough.

You can also create a calculation in parent which takes all the portal records and turns them into a bulleted list eliminating portal completely thus allowing portal rows to 'wrap'. But for report none of this makes sense. Can you provide screen shot, file or more information on what you want to do and what specifically is not working? We need to know the relationship and the table names as well as type of report.

Link to comment
Share on other sites

Are you aware that you can set fields to 'reduce or expand' (although that wording in v12 is incorrect because it only reduces)? Field height can adjust down if you make the field tall enough.

 

No. Slide up and across - yes, but how do you reduce or expand a field?

 

You can also create a calculation in parent which takes all the portal records and turns them into a bulleted list eliminating portal completely thus allowing portal rows to 'wrap'. But for report none of this makes sense.

 

Can you provide an example of your calculation?

Link to comment
Share on other sites

Hi Lee :^)

You can reduce fields in a report by previewing with set sliding to 'reduce' and also reducing enclosing parts. Make field maximum size ever needed. You know this ... notice this is for report. But we do not have enough information at this point to know what is really needed.

I would hate to suggest a calculation since it takes all child records and concatenates and can greatly increase size of parent table if the volume is large but basically pseudo-Calculation to create bulleted list and it will automatically be unstored (result is text):

"* " & Substitute ( List ( yourField ) ; Cr ; "* Cr" )

I cannot make pilcrow on iPad so I use Cr

EDITED. And no you can't expand. Versions prior to 12 have wording 'reduce' only ... In 12 that was changed to 'reduce and expand' but AFAIK the behavior was not changed to allow expand. Also I cannot look at FM to quote you the exact phrase but my wording is very close and the meaning is correct. :-)

Link to comment
Share on other sites

Hi LaRetta, 

 

Then I didn't miss a change in the Slide (reduce and expand) action in v12, whew.

 

Thanks for you calculation, I will play around with it a bit.

 

Lee

Link to comment
Share on other sites

I found a workaround for that at http://www.attorneyatwork.com/take-a-shortcut-to-faster-ipad-typing/

Shortcuts can help you type any number of often-used phrases, including:
  • A paragraph symbol, or “pilcrow”:  ¶.  Creating a pilcrow shortcut is the easiest way I know of to type that symbol on your iPad. The pilcrow is not on any of iPad’s keyboards, but if you use your computer to type a pilcrow into an e-mail to yourself, you can copy and paste it into the phrase field of a pilcrow shortcut.
 

Sorry for the confusing order; the board software apparently won't let me type anything after a quote.

 

I cannot make pilcrow on iPad so I use Cr
 

  • Like 1
Link to comment
Share on other sites

Thank you, Doug!! I keep saying I am not going to post when I only have iPad but I keep doing it. I have a new Mac wireless keyboard but I didn't bring it although I just discovered yesterday that my old CD case (if I remove the sleeves) fits perfectly and zips closed. Even though Macs rock, I doubt it has pilcrow on its keyboard either.

I shall do this! :^)

BTW, on that calc I just noticed that I only specified 'yourField' in the calc. It needs to be created in the parent table and include the child table occurrence , looking like:

childTable::yourField

I make more mistakes when on iPad, LOL. But calc PROBABLY isn't necessary once we get the requirements.

Edited by LaRetta
Link to comment
Share on other sites

Sorry for the confusing order; the board software apparently won't let me type anything after a quote.

I had the same problem and I will notify Stephen.

 

In the meantime, enter a couple of returns into the Body, and then place your cursor below where you want the quote.

 

HTH 

Link to comment
Share on other sites

You can also create a calculation in parent which takes all the portal records and turns them into a bulleted list eliminating portal completely thus allowing portal rows to 'wrap'. But for report none of this makes sense. Can you provide screen shot, file or more information on what you want to do and what specifically is not working? We need to know the relationship and the table names as well as type of report.

Hey LaRetta,

 

A small file is attached along with a couple of PDF flies of printouts.

The one line portal is what I am looking for. The two line portal is set to slide up and reduce the enclosing part when printing.

As you can see, it reduces the number of portal rows from 15 to 4 but does not reduce the size of the description field.

 

As usual, the website will not let me upload a FMP database.

 

Anyone know what I need to do to be able to upload these files?

post-102845-0-46441700-1354840966_thumb.

post-102845-0-55344700-1354840984_thumb.

RPetty_1LinePortalRow.pdf

RPetty_2LinePortalRow.pdf

Link to comment
Share on other sites

As you can see, it reduces the number of portal rows from 15 to 4 but does not reduce the size of the description field.

I can't see FM file because none attached but you should print from the portal table. Is there reason why you can't?
Link to comment
Share on other sites

Did you Zip them?

Thanks Lee.

 

I can't see FM file because none attached but you should print from the portal table. Is there reason why you can't?

Hi LaRetta,

 

If you referring to printing from the portal table as the same as printing line items, this won't work because there are going to be three portals on the report along with serveral checkbox, radio button and text fields.

 

I have attached a file for your reference.

 

As you can see on the print layout, the Repairs 1 portal is set as single line height and Repairs 2 is set as two-line height. Sliding and shrinking has been applied to both portals. Each portal has 7 rows.

The shrinking/sliding feature easily shrinks the portal from 7 rows to 4 and moves everything upward as desired.

 

What is not happening and what I am trying to program is in the two-line portal. I need to shrink the fields that require only one line and leave the fields that need be as two line fields.

 

I have been trying to accomplish this ever since I started fooling with FMP and I don't think there is a way to do it.

 

Now, if there is not a way to do this, what I would like to do is determine the number of characters the one-line portal is capable of showing in a field and then using a script trigger to automatically send the cursor south to the next portal row.

 

By doing this, I could still design my report for 1-line portals but still print all the info contained in the fields.

 

Many, many thanks...

Driver.zip

Link to comment
Share on other sites

Far easier to properly structure so the Repairs is a single table as it should be.  Otherwise you need to

  1. print from one of the repairs tables and place the other as a portal 
  2. use virtual technique or temp table
  3. create a calculation which concatenates them

I've attached #3 example.  However, since Server downloads all fields, such a calculation would/could stress your solution so I would put that calc into a related table 1:1 to Vehicles and the calc would be:

 

TextStyleAdd ("Repairs 1" ; Bold )
& ¶ &  
List ( Repairs 1::Description )
& ¶ &
TextStyleAdd ("Repairs 2" ; Bold )
& ¶ &
List ( Repairs 2::Description )

 

... then display this calc for reports only when needed (file attached).  However, ideally you would change the structure.

DriverREV1.zip

Link to comment
Share on other sites

This topic is 4151 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.