Page 1 of 1

How limit the number of characters maximum in a text field?

Posted: 2007-04-01 15:03:21
by RANICUAJO
In the print template that I use (create with "designer"), I would like to limit the number of characters that can appear in each text field.
Exists some form to do it with "script option" when the field is created? :hum:
Image

Also I would like to know as a text can be put in vertical position :??:

Thanks :wow:

Posted: 2007-04-01 18:14:14
by antp
Hi,
By vertical you mean rotated of 90/270°, or with letters like
T
E
X
T
?
in first case, you can chose the orientation of text blocks using a button of the toolbar. In second case it is not possible.

To limit the Length of a field, you can do the following:
Instead of having for example [Actors] in the text block, enter a new name, e.g. [shortActorsList]
Then check the "Script" option and enter the following in the bottom area:

Code: Select all

begin
  shortActorsList := Copy([Actors], 1, 50);
end;
To keep 50 characters starting at the 1st one.
Of course it may cut in the middle of a name...
You can add "(...)" at the end:

Code: Select all

begin
  shortActorsList := Copy([Actors], 1, 22) + '(...)';
end;
The report preview window of AMC may throw an error about a not found field when you refresh a template containing a script after having modified it, but it should work if you go to another template in the list then go back to your template.

Posted: 2007-04-02 17:18:31
by RANICUAJO
antp wrote:Hi,
By vertical you mean rotated of 90/270°, or with letters like
T
E
X
T
?
in first case, you can chose the orientation of text blocks using a button of the toolbar. In second case it is not possible.
Hi
Finally i see the button :ha: I was thinking in the easy mode (rotate 90/270) but my eyes don´t see very well :badidea:

To limit the Length of a field, you can do the following:
Instead of having for example [Actors] in the text block, enter a new name, e.g. [shortActorsList]
Then check the "Script" option and enter the following in the bottom area:

Code: Select all

begin
  shortActorsList := Copy([Actors], 1, 50);
end;
To keep 50 characters starting at the 1st one.
Of course it may cut in the middle of a name...
antp wrote: You can add "(...)" at the end:

Code: Select all

begin
  shortActorsList := Copy([Actors], 1, 22) + '(...)';
end;
Really you are in thel ine, but I have tried the 2 options (2ª is really better), but it use same "actors" data for all the films
(you will understand better in the image), and i have and error message when i try to print in a PDF "undefined symbol "actors"

Thanks for your help Antp :grinking:

Image

Posted: 2007-04-02 18:45:23
by antp
I do not know why it does not work.
This script things often has a quite random behavior. Sometimes it works, sometimes not.
It is a ready-to-use component that I integrated in AMC, so I do not know what causes that. Someday I should find why such errors occurs.

Posted: 2007-04-02 19:07:58
by RANICUAJO
I do not understand either so that it does not work, but don't worry too much antp.
Thanks again for your help and your patience :grinking:
Bye :wink:

Posted: 2007-04-03 16:41:27
by RANICUAJO
Hi antp
I have a partial solution.
I have created a new variable in the “variable editor” with the following expression


Image
The variable it initially stored in the group of "movie fields"

This is the result

Image

The print report work properly all time,. but the problem now is that when I open designer again, non encounter the new variable that I have created with object to edit it :??:

Where is stored the new variables? :??:
Bye :grinking:

Posted: 2007-04-03 19:36:34
by antp
I didn't even know that it was possible to add variables like that :lol:

Posted: 2007-04-04 16:27:05
by RANICUAJO
antp wrote:I didn't even know that it was possible to add variables like that :lol:
I hope that it can serve to you for something. New things are always discovered. I found it by chance, and knew that to put, thanks to the data that you gIve me. :D



I have a new question. :ha:
in a simple field of text (non variable for the moment :??: ...) for example “actors list” is possible to do that:
If “actors” lenght >0 then insert the text “actor list”
If “actors” lenght =0 then don't insert the text “actor lists”
When "actors" is the variable originated in AMC?

Thanks again

Posted: 2007-04-04 18:01:41
by antp
But if the text length is 0 there is nothing to insert, so the result will be the same, no ? :??:

Posted: 2007-04-04 18:54:59
by RANICUAJO
I'm thinkin in the label before the AMC information.

Image

Sorry for my bad english. It is so difficult to make understand me :ha: :ha: :ha:
I hope you understand the image.

Bye :grinking:

Posted: 2007-04-04 21:59:10
by antp
ok ;)
in the Script box of these text blocks, you can try to enter this:

Code: Select all

begin
  Visible := [Actors] <> '';
end;

Posted: 2007-04-05 07:44:33
by RANICUAJO
Script really works fine. :)
A million of thanks antp :grinking: :grinking: :grinking: