@if must have odd number of arguments

Hi,

I know this is the simplest doubt…but i am not able to solve…

pls help…

I have the below code on the column…

@If(Form=“SRDGen”;@If(Working_Status_2=“Pending - Sponsors/Doc Engineer Review” & DEApproval=“”;“DocEngineer”;Working_Status_2=“Pending - Sponsors/Doc Engineer Review” & @If(NumofSS=@ToNumber(“1”) & SSApproval1=“”;“Sponsors”;“Test1”);Working_Status_2=“S/W Productionization Review”|Working_Status_2=“Productionized Open - S/W Productionization Review” & SoftSenApproval=“”;“Software”;“Test2”);@False)

This code returns error which says @if must have an odd number of arguments…

wat can be worng in this code…

Subject: @if must have odd number of arguments…

It usually helps to write all conditions and results on seperate lines (and use indention, that is not shown here in this example on the web). This will make the code easier to understand for both yourself and others.

@If(Form=“SRDGen”;

@If(Working_Status_2="Pending - Sponsors/Doc Engineer Review" & DEApproval="";

		"DocEngineer";

	Working_Status_2="Pending - Sponsors/Doc Engineer Review" ;

		@If(NumofSS=@ToNumber("1") & SSApproval1="";"Sponsors";"Test1");

	Working_Status_2="S/W Productionization Review"|Working_Status_2="Productionized Open - S/W Productionization Review" & SoftSenApproval="";

	"Software";

"Test2"

);

@False)

I changed the &-symbol before the @if in the line

Working_Status_2=“Pending - Sponsors/Doc Engineer Review” & @If(NumofSS=@ToNumber(“1”) & SSApproval1=“”;“Sponsors”;“Test1”)

to a ;-sign

Also you might want to look at the line

Working_Status_2=“S/W Productionization Review”|Working_Status_2=“Productionized Open - S/W Productionization Review” & SoftSenApproval=“”

It is not advised yo use & and | in one statement like you do, this will give unpredictable results. Put brackets around the conditions you want to hold together, eg:

(Working_Status_2=“S/W Productionization Review”|Working_Status_2=“Productionized Open - S/W Productionization Review”) & SoftSenApproval=“”

or you could say

Working_Status_2=“S/W Productionization Review”: “Productionized Open - S/W Productionization Review” & SoftSenApproval=“”

Regards,

René

Subject: RE: @if must have odd number of arguments…

Thnaks everybody…As i was testing the application…I had not entered the entire code…i tried the options suggested by u all…n it worked…

i m pasting the code below…

this code is working…

@If(Form=“SRDGen”;@If(Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw” & DEApproval=“”;“DocEngineer”;Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw”&

NumofSS=1&SSApproval1=“”;“Sponsor”;Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw”&NumofSS=2&(SSApproval1=“”|SSApproval2=“”);“Sponsor”;Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw”&NumofSS=3&(SSApproval1=“”|SSApproval2=“”|SSApproval3=“”);“Sponsor”;Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw”&NumofSS=4 &(SSApproval1=“”|SSApproval2=“”|SSApproval3=“”|SSApproval4=“”);“Sponsor”;Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw”&NumofSS=5&(SSApproval1=“”|SSApproval2=“”|SSApproval3=“”|SSApproval4=“”|SSApproval5=“”);“Sponsor”;Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw”&NumofSS=6&(SSApproval1=“”|SSApproval2=“”|SSApproval3=“”|SSApproval4=“”|SSApproval5=“”|SSApproval6=“”);“Sponsor”;Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw”&NumofSS=7&(SSApproval1=“”|SSApproval2=“”|SSApproval3=“”|SSApproval4=“”|SSApproval5=“”|SSApproval6=“”|SSApproval7=“”);“Sponsor”;Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw”&NumofSS=8&(SSApproval1=“”|SSApproval2=“”|SSApproval3=“”|SSApproval4=“”|SSApproval5=“”|SSApproval6=“”|SSApproval7=“”|SSApproval8=“”);“Sponsor”;Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw”&NumofSS=9&(SSApproval1=“”|SSApproval2=“”|SSApproval3=“”|SSApproval4=“”|SSApproval5=“”|SSApproval6=“”|SSApproval7=“”|SSApproval8=“”|SSApproval9=“”);“Sponsor”;Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw”&NumofSS=10&(SSApproval1=“”|SSApproval2=“”|SSApproval3=“”|SSApproval4=“”|SSApproval5=“”|SSApproval6=“”|SSApproval7=“”|SSApproval8=“”|SSApproval9=“”|SSApproval10=“”);“Sponsor”;Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw”&NumofSS=11&(SSApproval=1|SSApproval2=“”|SSApproval3=“”|SSApproval4=“”|SSApproval5=“”|SSApproval6=“”|SSApproval7=“”|SSApproval8=“”|SSApproval9=“”|SSApproval10=“”|SSApproval11=“”);“Sponsor”;Working_Status_2=“Pending - Sponsors/Doc Engineer Reveiw”&NumofSS=12&(SSApproval1=“”|SSApproval2=“”|SSApproval3=“”|SSApproval4=“”|SSApproval5=“”|SSApproval6=“”|SSApproval7=“”|SSApproval8=“”|SSApproval9=“”|SSApproval10=“”|SSApproval11=“”|SSApproval12=“”);“Sponsor”;Working_Status_2=“S/W Productionization Review”|Working_Status_2=“Productionized Open - S/W Productionization Review”&SoftSenApproval=“”;“Software”;Working_Status_2);Working_Status_2)

Subject: RE: @if must have odd number of arguments…

After doing this…i came to know tht i need to addd more conditions in this…n conditions will keep on increasing…

Subject: @if must have odd number of arguments…

Let’s make that a bit more readable …

@If(

 Form="SRDGen";@If(

      Working_Status_2="Pending - Sponsors/Doc Engineer Review" & DEApproval="";"DocEngineer";

      Working_Status_2="Pending - Sponsors/Doc Engineer Review" & @If(

           NumofSS=@ToNumber("1") & SSApproval1="";"Sponsors";

           "Test1"

      );

      Working_Status_2="S/W Productionization Review" | Working_Status_2="Productionized Open - S/W

           Productionization Review" & SoftSenApproval="";"Software";

      "Test2"

      );

 @False

)

The Blue IF has 3 parameters. But it’s going to resolve to “Sponsors” or “Test1” and I don’t think that will work in that second parameter of the Red if.

The Red IF has 6 parameters, and that’s an error.

The Black IF has 3 parameters, and that’s okay.

Try this

@If(

 Form="SRDGen";@If(

     Working_Status_2="Pending - Sponsors/Doc Engineer Review" & DEApproval="";"DocEngineer";

     Working_Status_2="Pending - Sponsors/Doc Engineer Review" & NumofSS=@ToNumber("1") & SSApproval1="";"Sponsors";

     Working_Status_2="Pending - Sponsors/Doc Engineer Review";"Test1"

     Working_Status_2="S/W Productionization Review" | Working_Status_2="Productionized Open - S/W

           Productionization Review" & SoftSenApproval="";"Software";"Test2"

      );

 @False

)

Subject: @if must have odd number of arguments…

The problem is your second condition inside your second IF.

@If( Form=“SRDGen”;

@If( 	Working_Status_2="Pending - Sponsors/Doc Engineer Review" & DEApproval="";

		"DocEngineer";



	Working_Status_2="Pending - Sponsors/Doc Engineer Review" & 

	@If(	NumofSS=@ToNumber("1") & SSApproval1="";

			"Sponsors";

			"Test1"

	);



	Working_Status_2="S/W Productionization Review" |

	Working_Status_2="Productionized Open - S/W Productionization Review" &

	SoftSenApproval="";

		"Software";



		"Test2"

);

@False

)

I assume you don’t mean to have the and (&) there but instead meant:

@If( Form=“SRDGen”;

@If( 	Working_Status_2="Pending - Sponsors/Doc Engineer Review" & DEApproval="";

		"DocEngineer";



	Working_Status_2="Pending - Sponsors/Doc Engineer Review"; 

		@If(	NumofSS=@ToNumber("1") & SSApproval1="";

				"Sponsors";

				"Test1"

		);



	Working_Status_2="S/W Productionization Review" |

	Working_Status_2="Productionized Open - S/W Productionization Review" &

	SoftSenApproval="";

		"Software";



		"Test2"

);

@False

)

If you’re looking at this via the web, this should help make it readible:

@If( Form=“SRDGen”;

. . @If( . . Working_Status_2=“Pending - Sponsors/Doc Engineer Review” & DEApproval=“”;

. . . . . . “DocEngineer”;

. . . . Working_Status_2=“Pending - Sponsors/Doc Engineer Review” &

. . . . @If( NumofSS=@ToNumber(“1”) & SSApproval1=“”;

. . . . . . . . “Sponsors”;

. . . . . . . . “Test1”

. . . . );

. . . . Working_Status_2=“S/W Productionization Review” |

. . . . Working_Status_2=“Productionized Open - S/W Productionization Review” &

. . . . SoftSenApproval=“”;

. . . . . . “Software”;

. . . . . . “Test2”

. . );

. . @False

)

Change to:

@If( . . Form=“SRDGen”;

. . @If( . . Working_Status_2=“Pending - Sponsors/Doc Engineer Review” & DEApproval=“”;

. . . . . . “DocEngineer”;

. . . . Working_Status_2=“Pending - Sponsors/Doc Engineer Review”;

. . . . . . @If(. . NumofSS=@ToNumber(“1”) & SSApproval1=“”;

. . . . . . . . . . “Sponsors”;

. . . . . . . . . . “Test1”

. . . . . . );

. . . . Working_Status_2=“S/W Productionization Review” |

. . . . Working_Status_2=“Productionized Open - S/W Productionization Review” &

. . . . SoftSenApproval=“”;

. . . . . . “Software”;

. . . . . . “Test2”

. . );

. . @False

)