SSRL表达式抛出错误

时间:2017-07-20 11:37:00

标签: mysql reporting-services

如果值为0则为0,否则运行switch语句  它无论如何都会返回Nil。请帮忙

    =IIf(Fields!SpecialOvtHrs.Value>0,IIf(Fields!cfgCurrencySymbol.Value="OMR",Format(Fields!OvtPay.Value*Fields!ExchangeRate.Value / Fields!OvtHrs.Value,"#,##0.000"),
IIf(Fields!cfgCurrencySymbol.Value="BHD",Format(Fields!OvtPay.Value*Fields!ExchangeRate.Value / Fields!OvtHrs.Value,"#,##0.000"),
IIf(Fields!cfgCurrencySymbol.Value="AED",Format(Fields!OvtPay.Value*Fields!ExchangeRate.Value / Fields!OvtHrs.Value,"#,##0.00"),
IIf(Fields!cfgCurrencySymbol.Value="KWD",Format(Fields!OvtPay.Value / Fields!OvtHrs.Value *1,"#,##0.000"),
IIf(Fields!cfgCurrencySymbol.Value="JOD",Format(Fields!OvtPay.Value*Fields!ExchangeRate.Value / Fields!OvtHrs.Value,"#,##0.00"),
IIf(Fields!cfgCurrencySymbol.Value="QAR",Format(Fields!OvtPay.Value*Fields!ExchangeRate.Value / Fields!OvtHrs.Value,"#,##0.00"),
IIf(Fields!cfgCurrencySymbol.Value="SAR",Format(Fields!OvtPay.Value*Fields!ExchangeRate.Value / Fields!OvtHrs.Value,"#,##0.00"),"Nill"))))))),"Nill")


=Switch(Fields!SpecialOvtHrs.Value=0,0,

字段!cfgCurrencySymbol.Value = “OMR”,格式(场!OvtPay.Value 字段!ExchangeRate.Value, “#,## 0.000”),
领域!cfgCurrencySymbol.Value = “OMR”,格式(场!OvtPay.Value
领域!ExchangeRate.Value, “#,## 0.000”),                                                 领域!cfgCurrencySymbol.Value = “BHD”,格式(场!OvtPay.Value 领域!ExchangeRate.Value, “#,## 0.000”),                                                 领域!cfgCurrencySymbol.Value = “AED”,格式(场!OvtPay.Value 领域!ExchangeRate.Value, “#,## 0.00”),                                                 领域!cfgCurrencySymbol.Value = “KWD”,格式(字段!OvtPay.Value * 1, “#,## 0.000”),                                                 领域!cfgCurrencySymbol.Value = “JOD”,格式(领域!OvtPay.Value的字段!ExchangeRate.Value, “#,## 0.00”),                                                 领域!cfgCurrencySymbol.Value = “QAR”,格式(场!OvtPay.Value 领域!ExchangeRate.Value, “#,## 0.00”),                                                 领域!cfgCurrencySymbol.Value = “SAR”,格式(场!OvtPay.Value *领域!ExchangeRate.Value, “#,## 0.00”))。

2 个答案:

答案 0 :(得分:1)

尝试以下SWITCH语句。

=SWITCH(
    Fields!SpecialOvtHrs.Value <=0 , "Nill",
    Fields!cfgCurrencySymbol.Value="OMR", Format(Fields!OvtPay.Value*Fields!ExchangeRate.Value / Fields!OvtHrs.Value,"#,##0.000"),
    Fields!cfgCurrencySymbol.Value="BHD", Format(Fields!OvtPay.Value*Fields!ExchangeRate.Value / Fields!OvtHrs.Value,"#,##0.000"),
    Fields!cfgCurrencySymbol.Value="AED", Format(Fields!OvtPay.Value*Fields!ExchangeRate.Value / Fields!OvtHrs.Value,"#,##0.00"),
    Fields!cfgCurrencySymbol.Value="KWD", Format(Fields!OvtPay.Value / Fields!OvtHrs.Value *1,"#,##0.000"),
    Fields!cfgCurrencySymbol.Value="JOD", Format(Fields!OvtPay.Value*Fields!ExchangeRate.Value / Fields!OvtHrs.Value,"#,##0.00"),
    Fields!cfgCurrencySymbol.Value="QAR", Format(Fields!OvtPay.Value*Fields!ExchangeRate.Value / Fields!OvtHrs.Value,"#,##0.00"),
    Fields!cfgCurrencySymbol.Value="SAR", Format(Fields!OvtPay.Value*Fields!ExchangeRate.Value / Fields!OvtHrs.Value,"#,##0.00"),
    True, "No match")

要考虑的其他(可选)事项..

  • 在数据库中存储针对您的货币的次要单位数量(例如,“OMR”为3)。
  • 以当地货币'KWD'存储1的汇率,这样您就可以对所有实例使用相同的计算,此时您无需格式化。
  • 使用单元格格式属性中的次要单位,例如="n" & Fields!MinorUnits.Value,这会导致OMR的'n3')

答案 1 :(得分:1)

由于我没有您的数据样本,我假设cfgCurrencySymbol.Value中没有匹配。

当您进行字符串检查时,情况很重要,因此请使用正确的大小写或大写字母值,如下所示

$(document).ready(function(){
    $(document).on('click', '.resetForm', function(event) {
	    event.preventDefault();
	    /* Act on the event */
        location.reload();
    });

function base64ToBlob(base64, mime) 
{
    mime = mime || '';
    var sliceSize = 1024;
    var byteChars = window.atob(base64);
    var byteArrays = [];

    for (var offset = 0, len = byteChars.length; offset < len; offset += sliceSize) {
        var slice = byteChars.slice(offset, offset + sliceSize);
        var byteNumbers = new Array(slice.length);
        for (var i = 0; i < slice.length; i++) {
            byteNumbers[i] = slice.charCodeAt(i);
        }
        var byteArray = new Uint8Array(byteNumbers);
        byteArrays.push(byteArray);
    }
    return new Blob(byteArrays, {type: mime});
}


// FUNCTION MAKING CANVAS WITH SVG
function drawInlineSVG(ctx, rawSVG, callback) 
{
    var svg = new Blob([rawSVG], {type:"image/svg+xml;charset=utf-8"}),
                domURL = self.URL || self.webkitURL || self,
                url = domURL.createObjectURL(svg),
                img = new Image;
    img.onload = function () {
        ctx.drawImage(this, 0, 0); 
        domURL.revokeObjectURL(url);
        callback(this);
    };
    img.src = url;
}


//****************************************
function jim(){

    var svgText = document.getElementById("myViewer").outerHTML;
    var myCanvas = document.getElementById("canvas");
    var ctxt = myCanvas.getContext("2d");


    // FUNCTION TO SET ENCODED SVG TEXT IN INPUT
    drawInlineSVG(ctxt, svgText, function() {
        //lamba url
        shorternUrl = canvas.toDataURL("image/png");
        shorternUrl = shorternUrl.replace(/^data:image\/(png|jpg);base64,/, "");

        var blob = base64ToBlob(shorternUrl, 'image/png');
        var formData = new FormData();
        formData.append('encodeURL', blob);
        $.ajax({
                url:"upload.php",
                type: "POST", 
                cache: false,
                contentType: false,
                processData: false,
                data: formData})
        .done(function(e){
            $(".successMessageWrap").html('<div class="successMessageWrapTable"><div class="successMessage"><a class="resetForm" href="index.php"><i class="fa fa-close"></i></a><img src="images/logo.png"><h2>Thanks for using <span>Wheel of Life</span></h2><p>A copy of your wheel of life has been sent into your Email Id</p><a href="index.php" onclick="reloadPage();">Make New</a></div></div>');
        });


/*success: function(data)
{

$(".successMessageWrap").html('<div class="successMessageWrapTable"><div class="successMessage"><a class="resetForm" href="index.php"><i class="fa fa-close"></i></a><img src="images/logo.png"><h2>Thanks for using <span>Wheel of Life</span></h2><p>A copy of your wheel of life has been sent into your Email Id</p><a href="index.php" onclick="reloadPage();">Make New</a></div></div>');

}*/





});
}
//***************************

$('form').submit(function(e){
e.preventDefault();

//

if(check_radio('PhysicalRank','Physical Environment')==false){return false; }
if(check_input('EnyInput','Physical Environment')==false){return false;}

if(check_radio('BussinessRank','Business/Career')==false){return false; }
if(check_input('BussinessInput','Business/Career')==false){return false;}

if(check_radio('financeRank','Finances')==false){return false; }
if(check_input('FinanceInput','Finances')==false){return false;}

if(check_radio('HealthRank','Health')==false){return false; }
if(check_input('HealthInput','Health')==false){return false;}

if(check_radio('FFRank','Family & Friends')==false){return false; }
if(check_input('FFInput','Family & Friends')==false){return false;}

if(check_radio('RelationRank','Romance/ Relationships')==false){return false; }
if(check_input('RelationInput','Romance/ Relationships')==false){return false;}

if(check_radio('GrowthRank','Personal Growth')==false){return false; }
if(check_input('GrothInput','Personal Growth')==false){return false;}

if(check_radio('FunRank','Fun & Recreation')==false){return false; }
if(check_input('FunInput','Fun & Recreation')==false){return false;}



if(check_input('name','Name')==false){return false;}
if(check_input('email','Email')==false){return false;}



//diable submit
$("input#WheelSubmit").attr('type', '');
$("input#WheelSubmit").attr('disabled', 'disabled');



$(".successMessageWrap").fadeIn();


//AJAX
$.ajax({
url:"piechart.php",
type:"POST",
data:new FormData(this),
contentType: false,
processData:false,
cache:false,
success: function(data)
{

$(".piechartSvg").html(data);


jim();



}
});

//*************************



//AJAX
$.ajax({
url:"mail.php",
type:"POST",
data:new FormData(this),
contentType: false,
processData:false,
cache:false,
success: function(data)
{


$("#test").html(data);

}
});



});




});//main