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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable in report designer

Status
Not open for further replies.

R17

Programmer
Jan 20, 2003
267
PH


i have cvl as variable in my report,

Code:
 IIF(dtrupcode="VL",1,0)

it works fine if i put a text box and write in expression "cvl".

if i want to only print the cvl when cvl>0 i do,

Code:
IIF(cvl>0,cvl,0)

but say cvl=4, i want it to display "VL: 4" so i do it like this,

Code:
IIF(cvl>0,"VL: "+trim(str(cvl)),0)

it only prints "4".

what's wrong, any help pls?



 
HI

The syntax seems correct. But the copilation may not have taken effect and may be showing you the results of your earlier values.

1. When you compile the project, make sure that you are including Regenerate all components option.
2. Open the report again, do a mock movement of any one control, one point rigt and then back. Then save it. Recopile that.

:)


ramani :)
(Subramanian.G)
 
It should be either:
IIF(cvl>0,"VL: "+alltrim(str(cvl)),0) or
IIF(cvl>0,"VL: "+ltrim(str(cvl)),0).
I would also code it this way with a string 0.
IIF(cvl>0,"VL: "+alltrim(str(cvl)),"0")

Trim only removes trailing blanks. What was actually returned by IIF(cvl>0,"VL: "+trim(str(cvl)),0) was something like "VL: 4". The report field was not big enough to hold the whole string.

Jerry1117


 
R17,
as str(cvl) is default str(cvl,10,0), reduce it to
str(cvl,1)
Tesar
 


hi all thanks for your replies,

the space for the field is indeed wider in the report.

if i try using iif(cvl>0,"VL: "+alltrim(str(cvl)),"0") it only gives me ****.

iif(cvl>0,"VL: "+alltrim(str(cvl)),0) gives me only the value of cvl.

i wonder what's wrong here, any more help pls?
 


i noticed that when i try alltrim(str(cvl)) only, it gives me ****.

this is the same with all other variables i have in my report.

using str(cvl,1), still doesn't solve the problem.

 
pls. check the picture format property of your textbox. it maybe set to numeric when you are actually returning character data.

kilroy [trooper]
 

torturedmind,

tried that but still it gives me the ***.

weird, huh?

 
The only way I've been able to reproduce the asterisk behavior is by setting the variable to something invalid like:

cvl = 3/0


Jim
 
As torturedmind said, be sure and check the picture clause to make sure it is something other than '9999'. Even if the box appears wide enough to display the entire string, if it is limited to 4 characters, you will get '****'.
Also, since you are trying to display either character or numeric in you IIF(), make sure the IIF() reads like this:
iif(cvl>0,"VL: "+alltrim(str(cvl)),"0")
-instead of-
iif(cvl>0,"VL: "+alltrim(str(cvl)),0)

-Dave S.-
[cheers]
Even more Fox stuff at:
 


hi everyone,

i used sum in the calculate for the iif(dtr.upcode="V",1,0) and it worked just fine!

though i don't get it why, =)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top