Print Page | Close Window

Positioning a Field based on a formula

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=12697
Printed Date: 04 May 2024 at 11:47am


Topic: Positioning a Field based on a formula
Posted By: dkalsow
Subject: Positioning a Field based on a formula
Date Posted: 24 Mar 2011 at 6:19am
Good Morning,
 
Does anyone know how to position a field in crystal based on the previous field starting location, lenghth, and a constant amount of white space?
 
 


-------------
Thanks :)
dkalsow



Replies:
Posted By: DBlank
Date Posted: 24 Mar 2011 at 7:56am
you can use a formula to move the x position of a field.
The x value amount is based on twips- there are 1440 twips in an inch.
 
That being said it might be eaiser to just stick to field together in one formula


Posted By: dkalsow
Date Posted: 24 Mar 2011 at 7:59am
so how do I get the position of a specific field?

-------------
Thanks :)
dkalsow


Posted By: DBlank
Date Posted: 24 Mar 2011 at 8:05am
right click on the field
there is a size and position option
this gives you x and y in inches so you can multiply it by twips to get the position but the formula moves the field left (negative value) and right positive value relative to it's original starting position.
You will need to calulate the ending position of the field based on length of the data and then move the it around off of that.


Posted By: dkalsow
Date Posted: 24 Mar 2011 at 8:07am
that I know, but can I get it using a formula - not hard coding it in?

-------------
Thanks :)
dkalsow


Posted By: DBlank
Date Posted: 24 Mar 2011 at 10:07am
you mean you want to know where the right most portion of a word ends based on the length of the word, correct?
The field size does not change so it is not the postion of the field but a position within the field.
you would actually be overlaying your two fields to get them side by side
you will have to calculate postion X to move left as:
(-1) *
(
(starting postion of right field in twips)
-
(starting positon of the left field in twips + the length of the word in twips)
)
to get the length in twips I would make a guess at the size of each character and multiply that by the len(field)
 
the size of each character will vary based on font type, size , bold etc.
but make a guess and move it up or down a bit until you get it right



Print Page | Close Window