SSRS条件Exprssn

时间:2015-11-24 06:38:03

标签: reporting-services

请帮我解决这个问题。 我是SSRS的新手。

我想根据Amount (w/o Tax)&等不同的产品类别总结AEC,MCL,MFG。等...... 我使用了IIF&总和条件,但它会引发错误。

这里我已粘贴条件表达式plz通过它。

=IIf(((Fields!Prod_Horz_Category.Value="AEC",sum(Fields!Amt_w_o_Tax.Value)),IIf(Fields!Prod_Horz_Category.Value="ASB",sum(Fields!Amt_w_o_Tax.Value),IIf(Fields!Prod_Horz_Category.Value="MCL",sum(Fields!Amt_w_o_Tax.Value),IIf(Fields!Prod_Horz_Category.Value="ME",sum(Fields!Amt_w_o_Tax.Value),IIf(Fields!Prod_Horz_Category.Value="MFG",sum(Fields!Amt_w_o_Tax.Value),IIf(Fields!Prod_Horz_Category.Value="TRG",sum(Fields!Amt_w_o_Tax.Value),IIf(Fields!Prod_Horz_Category.Value="SUB",sum(Fields!Amt_w_o_Tax.Value),0))

1 个答案:

答案 0 :(得分:0)

您似乎使用嵌套的if语句执行此操作,而不是正确格式化。

如果在计算中插入换行符和缩进,则可以轻松查看出错的地方

function sendVerificationEmail(user, req, res) {
    return denodeify(crypto.randomBytes)(20)
        .then(function (buffer) {
            user.verificationToken = buffer.toString('hex');
            return user.save();
        })
        .then(function () {
            user.password = undefined;
            user.salt = undefined;
            delete req.session.redirect_to;

            return denodeify(res.render)(path.resolve('modules/users/server/templates/verify-email'), {
                name: user.displayName,
                appName: config.app.title,
                mail: user.email,
                url: 'http://' + req.headers.host + '/api/auth/verify/' + user.verificationToken + "/" + user.email
            });
        })
        .then(function (emailHTML) {
            const mailOptions = {
                to: user.email,
                from: config.mailer.from,
                subject: 'Verify Email',
                html: emailHTML
            };
            return denodeify(smtpTransport.sendMail)(mailOptions);
        });
}

exports.updateAuthData = function (req, res, next) {
    const userId = req.session.userId;
    delete req.session.userId;

    if (!userId) {
        return res.status(401).send({
            message: 'No active session'
        });
    }

    let user;

    User.findById(userId)
        .then()
        .then((_user) => {
            user = _user;

            const fields = Object.keys(req.body);
            const neededFields = user.getMissingAuthFields();
            const missingFields = _.difference(fields, neededFields);

            if (missingFields.length !== 0) {
                throw new CustomError('Missing fields: ' + missingFields.join(', '))
            }

            for (let field of User.requiredAuthorizationFields) {
                if (!!user[field]) {
                    throw new CustomError('User already has ' + field);
                }
            }

            User.requiredAuthorizationFields.forEach((field) => user[field] = req.body[field]);

            return true;
        })
        .then(function () {
            return sendVerificationEmail(user, req, res);
        })
        .then(() => {
            res.send({
                message: 'An email has been sent to the provided email, please verify your account.'
            });
        })
        .catch(function (err) {
            res.status(400).send({
                message: 'Failure sending email'
            });
        })
};

那些开口大括号=IIf( ( (Fields!Prod_Horz_Category.Value="AEC", sum(Fields!Amt_w_o_Tax.Value) ), IIf(Fields!Prod_Horz_Category.Value="ASB", sum(Fields!Amt_w_o_Tax.Value), IIf(Fields!Prod_Horz_Category.Value="MCL", sum(Fields!Amt_w_o_Tax.Value), IIf(Fields!Prod_Horz_Category.Value="ME", sum(Fields!Amt_w_o_Tax.Value), IIf(Fields!Prod_Horz_Category.Value="MFG", sum(Fields!Amt_w_o_Tax.Value), IIf(Fields!Prod_Horz_Category.Value="TRG", sum(Fields!Amt_w_o_Tax.Value), IIf(Fields!Prod_Horz_Category.Value="SUB", sum(Fields!Amt_w_o_Tax.Value) ,0) ) 不属于,你的第一个(没有足够的条件,并且没有足够的近距离大括号IIF来完成表达式

我不确定嵌套是否在这里使用是正确的函数 - SWITCH会更有意义,即。

)