Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Reports 9, SQL Server 7 - shared variables

Status
Not open for further replies.

hsandwick

Programmer
Sep 10, 2001
286
US
I have working shared vars for stringvar and datevar.

Now I'm working w/currency and decimal vars and am running into issues. What am I doing wrong, please?

Example that works (using an XTABLE, and basing results on IDs that relate to template screens):

In Collect Values ...
shared stringvar Name;
IF {Command.CustomTplDID(1)} = '4AM58DC22FS030' THEN Name := ({Command.Description});

then the formula field is created ...
shared stringvar Name;
IF Name > "" THEN Name;

then reset vars ...
shared stringvar Name := "";


That all works.
Dates work, too.


If the field is command.valuemoney or command.decimal, I'm running into problems. How should these be structured, please, to follow the string sample above? What are the defaults for reset vars, and so on?

Thanks very much,

Helen
 
Use currencyvar for a money type, and just use:

currencyvar MyCur:=0 to reset it.

As for decimal, you should post the precision that you need. Example data really helps to clarify. I think thayt you just want a numbervar. I've had occasions where I needed to cheat by multiplying the number by some factor because I was losing precision. This might be most reliably done using a SQL Expression.

These are the available variable declarations:

Local BooleanVar x
Local NumberVar x
Local CurrencyVar x
Local DateVar x
Local TimeVar x
Local DateTimeVar x
Local StringVar x
Local NumberVar range x
Local CurrencyVar range x
Local DateVar range x
Local TimeVar range x
Local DateTimeVar range x
Local StringVar range x
Local BooleanVar array x
Local NumberVar array x
Local CurrencyVar array x
Local DateVar array x
Local TimeVar array x
Local DateTimeVar array x
Local StringVar array x
Local NumberVar range array x
Local CurrencyVar range array x
Local DateVar range array x
Local TimeVar range array x
Local DateTimeVar range array x
Local StringVar range array x

-k
 
Thank you, synapsvampire, I really appreciate your feedback!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top