SSRS IF Statement with incorrect syntax











up vote
0
down vote

favorite












I'm new to SSRS and find the syntax very difficult as well as the awful expression text box that makes it very hard to see where i've made errors.



I want to do IFF (First(Fields!TaxNumber.Value, "InvoiceHeader") = null, then only print IS02Chars.value, else print both IS02Chars and TaxNumber.Value.



  =IFF (First(Fields!TaxNumber.Value, "InvoiceHeader") = null ,
": " & First(Fields!ISO2Chars.Value, "InvoiceHeader"),
": " & First(Fields!ISO2Chars.Value, "InvoiceHeader") & First(Fields!TaxNumber.Value, "InvoiceHeader"))


I don't see how my syntax is any different to IIF(Fields!ExitReason.Value = 7, 1, 0)










share|improve this question
























  • You need to add a second part for the IIF condition turns out to be FALSE. Add a comma prior to the double close brackets and enter something that needs to be returned when the value is not null
    – MiguelH
    Nov 8 at 11:23










  • Can't I do IFF NULL show IS02Chars else Show IS02Chars AND TaxNumber? The second part acts as my not null
    – Fusiozii
    Nov 8 at 11:29










  • Are these numeric value? If so. you'll need to cast these as strings (Cstr ) if you want to concatenate with other values...
    – MiguelH
    Nov 8 at 11:39










  • @Greg2 I'm sure =IFF is not correct syntax, it should normally be =IIF. Plus you would want to do as Miguel said and cast if your values are numeric before concatenating them.
    – arahman
    Nov 8 at 11:56












  • @Greg2 I completely missed the =IFF! Good spotting! :-)
    – MiguelH
    Nov 8 at 12:29















up vote
0
down vote

favorite












I'm new to SSRS and find the syntax very difficult as well as the awful expression text box that makes it very hard to see where i've made errors.



I want to do IFF (First(Fields!TaxNumber.Value, "InvoiceHeader") = null, then only print IS02Chars.value, else print both IS02Chars and TaxNumber.Value.



  =IFF (First(Fields!TaxNumber.Value, "InvoiceHeader") = null ,
": " & First(Fields!ISO2Chars.Value, "InvoiceHeader"),
": " & First(Fields!ISO2Chars.Value, "InvoiceHeader") & First(Fields!TaxNumber.Value, "InvoiceHeader"))


I don't see how my syntax is any different to IIF(Fields!ExitReason.Value = 7, 1, 0)










share|improve this question
























  • You need to add a second part for the IIF condition turns out to be FALSE. Add a comma prior to the double close brackets and enter something that needs to be returned when the value is not null
    – MiguelH
    Nov 8 at 11:23










  • Can't I do IFF NULL show IS02Chars else Show IS02Chars AND TaxNumber? The second part acts as my not null
    – Fusiozii
    Nov 8 at 11:29










  • Are these numeric value? If so. you'll need to cast these as strings (Cstr ) if you want to concatenate with other values...
    – MiguelH
    Nov 8 at 11:39










  • @Greg2 I'm sure =IFF is not correct syntax, it should normally be =IIF. Plus you would want to do as Miguel said and cast if your values are numeric before concatenating them.
    – arahman
    Nov 8 at 11:56












  • @Greg2 I completely missed the =IFF! Good spotting! :-)
    – MiguelH
    Nov 8 at 12:29













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm new to SSRS and find the syntax very difficult as well as the awful expression text box that makes it very hard to see where i've made errors.



I want to do IFF (First(Fields!TaxNumber.Value, "InvoiceHeader") = null, then only print IS02Chars.value, else print both IS02Chars and TaxNumber.Value.



  =IFF (First(Fields!TaxNumber.Value, "InvoiceHeader") = null ,
": " & First(Fields!ISO2Chars.Value, "InvoiceHeader"),
": " & First(Fields!ISO2Chars.Value, "InvoiceHeader") & First(Fields!TaxNumber.Value, "InvoiceHeader"))


I don't see how my syntax is any different to IIF(Fields!ExitReason.Value = 7, 1, 0)










share|improve this question















I'm new to SSRS and find the syntax very difficult as well as the awful expression text box that makes it very hard to see where i've made errors.



I want to do IFF (First(Fields!TaxNumber.Value, "InvoiceHeader") = null, then only print IS02Chars.value, else print both IS02Chars and TaxNumber.Value.



  =IFF (First(Fields!TaxNumber.Value, "InvoiceHeader") = null ,
": " & First(Fields!ISO2Chars.Value, "InvoiceHeader"),
": " & First(Fields!ISO2Chars.Value, "InvoiceHeader") & First(Fields!TaxNumber.Value, "InvoiceHeader"))


I don't see how my syntax is any different to IIF(Fields!ExitReason.Value = 7, 1, 0)







if-statement reporting-services syntax expression






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 11:36

























asked Nov 8 at 11:12









Fusiozii

225




225












  • You need to add a second part for the IIF condition turns out to be FALSE. Add a comma prior to the double close brackets and enter something that needs to be returned when the value is not null
    – MiguelH
    Nov 8 at 11:23










  • Can't I do IFF NULL show IS02Chars else Show IS02Chars AND TaxNumber? The second part acts as my not null
    – Fusiozii
    Nov 8 at 11:29










  • Are these numeric value? If so. you'll need to cast these as strings (Cstr ) if you want to concatenate with other values...
    – MiguelH
    Nov 8 at 11:39










  • @Greg2 I'm sure =IFF is not correct syntax, it should normally be =IIF. Plus you would want to do as Miguel said and cast if your values are numeric before concatenating them.
    – arahman
    Nov 8 at 11:56












  • @Greg2 I completely missed the =IFF! Good spotting! :-)
    – MiguelH
    Nov 8 at 12:29


















  • You need to add a second part for the IIF condition turns out to be FALSE. Add a comma prior to the double close brackets and enter something that needs to be returned when the value is not null
    – MiguelH
    Nov 8 at 11:23










  • Can't I do IFF NULL show IS02Chars else Show IS02Chars AND TaxNumber? The second part acts as my not null
    – Fusiozii
    Nov 8 at 11:29










  • Are these numeric value? If so. you'll need to cast these as strings (Cstr ) if you want to concatenate with other values...
    – MiguelH
    Nov 8 at 11:39










  • @Greg2 I'm sure =IFF is not correct syntax, it should normally be =IIF. Plus you would want to do as Miguel said and cast if your values are numeric before concatenating them.
    – arahman
    Nov 8 at 11:56












  • @Greg2 I completely missed the =IFF! Good spotting! :-)
    – MiguelH
    Nov 8 at 12:29
















You need to add a second part for the IIF condition turns out to be FALSE. Add a comma prior to the double close brackets and enter something that needs to be returned when the value is not null
– MiguelH
Nov 8 at 11:23




You need to add a second part for the IIF condition turns out to be FALSE. Add a comma prior to the double close brackets and enter something that needs to be returned when the value is not null
– MiguelH
Nov 8 at 11:23












Can't I do IFF NULL show IS02Chars else Show IS02Chars AND TaxNumber? The second part acts as my not null
– Fusiozii
Nov 8 at 11:29




Can't I do IFF NULL show IS02Chars else Show IS02Chars AND TaxNumber? The second part acts as my not null
– Fusiozii
Nov 8 at 11:29












Are these numeric value? If so. you'll need to cast these as strings (Cstr ) if you want to concatenate with other values...
– MiguelH
Nov 8 at 11:39




Are these numeric value? If so. you'll need to cast these as strings (Cstr ) if you want to concatenate with other values...
– MiguelH
Nov 8 at 11:39












@Greg2 I'm sure =IFF is not correct syntax, it should normally be =IIF. Plus you would want to do as Miguel said and cast if your values are numeric before concatenating them.
– arahman
Nov 8 at 11:56






@Greg2 I'm sure =IFF is not correct syntax, it should normally be =IIF. Plus you would want to do as Miguel said and cast if your values are numeric before concatenating them.
– arahman
Nov 8 at 11:56














@Greg2 I completely missed the =IFF! Good spotting! :-)
– MiguelH
Nov 8 at 12:29




@Greg2 I completely missed the =IFF! Good spotting! :-)
– MiguelH
Nov 8 at 12:29












1 Answer
1






active

oldest

votes

















up vote
0
down vote













  =IIF(IsNothing(First(Fields!TaxNumber.Value, "InvoiceHeader")), ": "
& First(Fields!ISO2Chars.Value, "InvoiceHeader") , ": " &
First(Fields!ISO2Chars.Value, "InvoiceHeader") &
First(Fields!TaxNumber.Value, "InvoiceHeader" ) )





share|improve this answer

















  • 1




    Generally, answers are much more helpful if they include an explanation of what the code is intended to do, and why that solves the problem without introducing others.
    – lucascaro
    Nov 9 at 6:47











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206583%2fssrs-if-statement-with-incorrect-syntax%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













  =IIF(IsNothing(First(Fields!TaxNumber.Value, "InvoiceHeader")), ": "
& First(Fields!ISO2Chars.Value, "InvoiceHeader") , ": " &
First(Fields!ISO2Chars.Value, "InvoiceHeader") &
First(Fields!TaxNumber.Value, "InvoiceHeader" ) )





share|improve this answer

















  • 1




    Generally, answers are much more helpful if they include an explanation of what the code is intended to do, and why that solves the problem without introducing others.
    – lucascaro
    Nov 9 at 6:47















up vote
0
down vote













  =IIF(IsNothing(First(Fields!TaxNumber.Value, "InvoiceHeader")), ": "
& First(Fields!ISO2Chars.Value, "InvoiceHeader") , ": " &
First(Fields!ISO2Chars.Value, "InvoiceHeader") &
First(Fields!TaxNumber.Value, "InvoiceHeader" ) )





share|improve this answer

















  • 1




    Generally, answers are much more helpful if they include an explanation of what the code is intended to do, and why that solves the problem without introducing others.
    – lucascaro
    Nov 9 at 6:47













up vote
0
down vote










up vote
0
down vote









  =IIF(IsNothing(First(Fields!TaxNumber.Value, "InvoiceHeader")), ": "
& First(Fields!ISO2Chars.Value, "InvoiceHeader") , ": " &
First(Fields!ISO2Chars.Value, "InvoiceHeader") &
First(Fields!TaxNumber.Value, "InvoiceHeader" ) )





share|improve this answer












  =IIF(IsNothing(First(Fields!TaxNumber.Value, "InvoiceHeader")), ": "
& First(Fields!ISO2Chars.Value, "InvoiceHeader") , ": " &
First(Fields!ISO2Chars.Value, "InvoiceHeader") &
First(Fields!TaxNumber.Value, "InvoiceHeader" ) )






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 8 at 14:06









Fusiozii

225




225








  • 1




    Generally, answers are much more helpful if they include an explanation of what the code is intended to do, and why that solves the problem without introducing others.
    – lucascaro
    Nov 9 at 6:47














  • 1




    Generally, answers are much more helpful if they include an explanation of what the code is intended to do, and why that solves the problem without introducing others.
    – lucascaro
    Nov 9 at 6:47








1




1




Generally, answers are much more helpful if they include an explanation of what the code is intended to do, and why that solves the problem without introducing others.
– lucascaro
Nov 9 at 6:47




Generally, answers are much more helpful if they include an explanation of what the code is intended to do, and why that solves the problem without introducing others.
– lucascaro
Nov 9 at 6:47


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206583%2fssrs-if-statement-with-incorrect-syntax%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)