Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Using a field within a field for a value?

Author  Topic 

JGaston
Starting Member

8 Posts

Posted - 2013-09-11 : 17:28:51
Hi and thanks for helping an amateur.

I want to use a value like this:

=Fields!wghtX.Value

but the X should be replaced the value of another field:

=Fields!palletNum.Value

so...

for palletnum 1 i would get wght1
for palletnum 2 i would get wght2
for palletnum 3 i would get wght3
and so on...

any help would be wonderful! thanks!

-Jesse

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-09-11 : 17:43:53
As far as I know, SSRS does not support dynamic values for field identifiers. If the palletnum's are a known set, you could use a SWITCH expression. That is the best I can think of.

Another option would be to modify your underlying SQL query to return the data in the correct form in a single column - i.e., wght1 for pallenum = 1, wght2 for pallentnum=2 and so on.
Go to Top of Page

JGaston
Starting Member

8 Posts

Posted - 2013-09-11 : 19:19:04
thanks a bunch man. was able to use the switch expression to get what i needed. really appreciate it.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-09-12 : 16:32:36
you can always make a parameter say XValue and map it to a dataset which returns palletNum values (1,2,3..). then you can simply use

=Fields("wght" & Cstr(Parameters!XValue.Value)).Value

in the expressions

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -