There is an error on line 58 of custom code: [BC30201] Expression expected

后端 未结 1 1006
盖世英雄少女心
盖世英雄少女心 2021-01-19 03:37

When we deploy a report SSRS generates the following error:

There is an error on line 58 of custom code: [BC30201] Expression expected

相关标签:
1条回答
  • 2021-01-19 04:08

    The conclusion - SSRS has an evil way to deal with ternaries, even though it fully expects VB code in the custom code segment.

    This error I had received was misdirecting, and pointed to the wrong line even - it was the line right below this one I marked in the question.

    Notice the Usage of ternaries : If(index = 2, " und ", String.Empty) - SSRS tries to run the If-ternary (as you would declare it in VB.NET) as a If..Then block - and because no Then is found, and there are multiple arguments comma-separated, this muddles SSRS and thus it prints Expression Expected

    The way to fix this issue is the Traditional SSRS Expressional way

    'Instead of this:
    If(index = 2, " und ", String.Empty)
    
    'Use This:
    IIf(index = 2, " und ", String.Empty)
    

    This should still allow you to preview your code (even the normal If allowed you to preview, but breaks during deploy)

    0 讨论(0)
提交回复
热议问题