We help IT Professionals succeed at work.

Concatenating @if statements

prasadp69
prasadp69 asked
on
I have a question regarding nesting of @if statements.

I have two conditions to check for(country code & manager name). Like this, I have three countries to check for.

Then I need to concatenate these three conditions by nesting @if loops. When I put this for one country, it is working fine. I tried to use & in between these three categories for concatenation.

If there is any other way to check for these three categories please let me know. Thank you for your help in advance.


The code looks like this:

@If(@Name([CN]; @UserName)=@ProperCase(Mgr_Name) & @If (Country="Mexico");
@MailSend("xxxxxxxxxxxxx"; ""; ""; "Security Request "; " Please be advised that a Security Request has been approved and requires your attention,"; @NewLine + Purpose + "  Click here to access the security request.  ==>"; [IncludeDoclink]);@Prompt([OK];"Authorization Failure";"You are not authorized to approve this request"));

@If(@Name([CN]; @UserName)=@ProperCase(Mgr_Name) & @If (Country="Canada");
@MailSend("yyyyyyyyyyyy"; ""; ""; "Security Request "; " Please be advised that a Security Request has been approved and requires your attention,"; @NewLine + Purpose + "  Click here to access the security request.  ==>"; [IncludeDoclink]);@Prompt([OK];"Authorization Failure";"You are not authorized to approve this request"));

@If(@Name([CN]; @UserName)=@ProperCase(Mgr_Name) & @If (Country="United States");
@MailSend("zzzzzzzzzzzz"; ""; ""; "Security Request "; " Please be advised that a Security Request has been approved and requires your attention,"; @NewLine + Purpose + "  Click here to access the security request.  ==>"; [IncludeDoclink]);@Prompt([OK];"Authorization Failure";"You are not authorized to approve this request"));
Comment
Watch Question

Try this,

@If(@Name([CN]; @UserName)=@ProperCase(Mgr_Name) & @If (Country="Mexico");
@MailSend("xxxxxxxxxxxxx"; ""; ""; "Security Request "; " Please be advised that a Security Request
has been approved and requires your attention,"; @NewLine + Purpose + "  Click here to access the security
request.  ==>"; [IncludeDoclink]);
@Name([CN]; @UserName)=@ProperCase(Mgr_Name) & @If (Country="Canada");
@MailSend("yyyyyyyyyyyy"; ""; ""; "Security Request "; " Please be advised that a Security Request has
been approved and requires your attention,"; @NewLine + Purpose + "  Click here to access the security
request.  ==>"; [IncludeDoclink]);
@Name([CN]; @UserName)=@ProperCase(Mgr_Name) & @If (Country="United States");
@MailSend("zzzzzzzzzzzz"; ""; ""; "Security Request "; " Please be advised that a Security Request has
been approved and requires your attention,"; @NewLine + Purpose + "  Click here to access the security
request.  ==>"; [IncludeDoclink]);
@Prompt([OK];"Authorization Failure";"You are not authorized to approve
this request"));

~Hemanth

Explore More ContentExplore courses, solutions, and other research materials related to this topic.