sql-serverreporting-servicesssrs-2008

How to use resource file value in the expression in RDLC file


I have a SSRS report which has its dedicated resource file.

This will work for populating the label with a value from resx file.

<TextRun>
          <Value rd:LocID="Function" />

What I struggle to do is, to use that inside switch statement:

 <TextRun>
   <Value>
                =Switch(
                Parameters!FunctionFlags.Value = "1,0,0", CStr(rd:LocID="Function"),
                Parameters!FunctionFlags.Value = "0,1,0", "Option 2",
                Parameters!FunctionFlags.Value = "0,0,1", "Another option",
                1 = 1, "Multiple"
                )
            </Value>

Please note that I only updated the top of the three options, but this is the point of failure. Is this possible to do? Anyone knows how the correct syntax would look like?

Changing the quoted string for resource reference will result in: Report definition is not valid error.

Thanks


Solution

  • The rd:LocID property is used for localization purposes in RDLC reports, and it's not directly usable in expressions like you're attempting. Instead, you should use the Resources object to reference values from the resource file.

    <TextRun>
      <Value>
        =Switch(
          Parameters!FunctionFlags.Value = "1,0,0", Resources.Function,
          Parameters!FunctionFlags.Value = "0,1,0", "Option 2",
          Parameters!FunctionFlags.Value = "0,0,1", "Another option",
          True, "Multiple"
        )
      </Value>
    </TextRun>