on 08-25-2016 7:58 PM
Hello,
I have a formula here for a sub report that check from my main report for values here.
If the value from main report (SDay1) if it's a positive number then I want to put this value in "-" if that number is negative then I want to add in from another variable (WIPMAIN and divided from number in the database)
Here is my formula:
WhilePrintingRecords;
Shared Numbervar SDay1;
Shared Numbervar WDay1;
Shared Numbervar WIPMAIN;
Shared Numbervar WTemp1;
Shared Stringvar STemp;
If (Sday1 > 0) Then
(
WTemp1 := (WIPMAIN / {V_STRUC_HDR_COMP_ISS_DATA.COMP_PART_QTY_PER_ASSEMBLY})+ Sday1; //Place holder need for other calculations
WDay1 := 0
)
Else
(
If (WIPMAIN =0) Then
WDAY1 := 0
Else
WDay1 := (WIPMAIN / {V_STRUC_HDR_COMP_ISS_DATA.COMP_PART_QTY_PER_ASSEMBLY})+ Sday1
);
I tried this on the first if statment
If (Sday1 > 0) then
(
WTemp1 : = the same as above .....
WDay1 := totext("-")
it gives me an error saying it requires a number here.
I tried to replace totext to CSTR, same error.
If anyone can help I would appreciated it.
Regards,
Gerald
Hi Gerald,
If you look at the below code, you are trying to assign a text value to a numeric variable. Either you have to change variable data type or assign 0 instead of -
If (Sday1 > 0) then
(
WTemp1 : = the same as above .....
WDay1 := totext("-")
Thanks,
Sastry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gerald,
I think crystal report formula does not allow you to do that because you are trying to assign string value to a number data type.
If you just want to display "-" in your output then i think you can try to use another formula on that.
Regards,
Eric
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gerald,
You'd need to make sure that the variable 'WDay1' returns text in every part of the if-else loop.
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.