0

Dears, I have table in Microsoft SQL server DB as follow:

SysNameFlag | NotificationTime 
1           | 02:55:01         
1           | 07:40:00         
9           | 10:55:06  

Each SysNameFlag refer to specific system name. My question is how is it able to display the data in SSRS as for each value "1" in SysNameFlag display as "Android" and so on?

Thank you.

neer
  • 4,031
  • 6
  • 20
  • 34
Sara
  • 1
  • 1
  • Are your `SysNameFlag` descriptions held in another table or do you need to manually code them? – iamdave Sep 27 '16 at 16:04
  • You can hardcode, as Prdp answered, but ideally you should have another dictionary table which resolves flags into descriptions. Then you will join that dictionary table to your data table by the flag and look up the description. – ajeh Sep 27 '16 at 18:53

3 Answers3

0

Use Case statement

Case SysNameFlag when 1 then 'Android' 
                 when 9 then 'Another OS' 
          Else 'Default OS'  End

You can add additional condition based on requirement

Pரதீப்
  • 91,748
  • 19
  • 131
  • 172
0

If you dont have a table for joining to get the proper values you can use an expression in SSRS like below.

=IIF(Fields!SysNameFlag = 1, "Android", "SomethingElse")
NewGuy
  • 1,020
  • 1
  • 9
  • 24
  • `Iff` optimizes into `case`, so this is the same as above. But are you sure you should be suggesting hardcoding instead of lookup? – ajeh Sep 27 '16 at 18:54
  • I did say if she didn't have a table to look up the values she could use an expression in her report. Thanks for the input. – NewGuy Sep 27 '16 at 20:02
0

Assuming you have no Look up otion avaialble and If you want to achieve it on Report level go with IIF (if number of flags are less) or SWITCH (to make it less complicated expression).

=SWITCH
(
    Fields!SysNameFlag.Value = 1, "Android", 
    Fields!SysNameFlag.Value = 9, "Non Android",
    TRUE, "Other OS"
)

The last condition is for default other then 1 and 9.

p2k
  • 2,126
  • 4
  • 23
  • 39