cancel
Showing results for 
Search instead for 
Did you mean: 

Units for Crystal Width and Height adjustment Formulae ?

Former Member
0 Kudos

Hello,

Is it possible to restrict the length of a text box in crystal reports 2008 based on a value from the database (say, datafield length : 20 characters) ?

Using the 'Size and position' dialog, it is possible to set the width of the text box; however, i am unsure what units CR uses in this dialog. Is it characters, pixels , twips, etc?

If table.fieldlength = 'short or 20 characters'

then width = X units

else width = Y units

Thanks for your help !

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

CR uses twips in the size and position.

1440 twips=1 inch

Regards,

Raghavendra

Former Member
0 Kudos

Thanks Raghavendra.

Do you know if there is a mapping between twips and 'characters' (typical units for database field lengths) ?

Fields in the field explorer come from the database, and can only be represented in characters; i need to set a conditional formula in the size and position dialog that reads the length of this field and accordingly limits the text box dimensions.

Any hints?

Thanks !

Former Member
0 Kudos

If it is a databse field then try this

right click on the field in report and go to format field>go to border tab>check the option Tight Horizontal.

I hope this helps!

Raghavendra

Former Member
0 Kudos

Thanks, that taught me an option i wasn't aware of.

However, this is for a user-added text box. The 'tight horizontal' option is grayed out.

What im looking to do is control the dimensions of the 'TEXTBOX' based on the vlaue / length of a 'DATABASE FIELD' length.

Thanks again

Former Member
0 Kudos

I think you need to try something like this

if you have any field from database then in the size and position use X+2 option and write the formula like this

1440*len() it may be a bigger in size but you need to figure out how much width it is taking for each character. May be you can get that by inserting a texbox and enter one character and adjust the size to fit perfectly without any space and see how much width it is taking. It may take for example 0.08 inch for each character. By using the formula like this 1440(0.08)len()

gives you the output.

I think there might be another solution but I hope this will help you to some extent.

I still don't understand why you want to do it for the text object as it is a databse field, you can directly drag that object on to the report then the option "Tight Horizontal" will be enabled and you can use it. If it is a static text then you can adujst the width of the textbox accordingly.

Regards,

Raghavendra

Answers (0)