SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Report Builder


SQL Report Builder

Author
Message
mark.johnson 26410
mark.johnson 26410
SSC-Enthusiastic
SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)

Group: General Forum Members
Points: 111 Visits: 9
Hi,

Not sure where to put this...

Im working in SQL Report Builder (sorry dont know which version) and am having trouble with calculated fields.

Ive got 2 datasets - one with some tenancy information in it (DataSet1) and the other with address data in it (DataSet2)

Ive got a calculated field that ive called "DaysVoid" which is essentially one date subtracted by another.

I want to work out the total sum of all of the "DaysVoid" so have set up another calculated field which is called "TotalDaysVoid" //=sum(DaysVoid)\\ but when I run my query, I get the following error;

//The Value expression for the textrun ‘Textbox34.Paragraphs[0].TextRuns[0]’ contains an error: [BC30451] Name 'DaysVoid' is not declared.\\

Can anybody help?
happycat59
happycat59
SSCrazy Eights
SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)SSCrazy Eights (8.7K reputation)

Group: General Forum Members
Points: 8749 Visits: 3281
Try using the following expression in textbo34:

=sum(Fields!DaysVoid)



mark.johnson 26410
mark.johnson 26410
SSC-Enthusiastic
SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)

Group: General Forum Members
Points: 111 Visits: 9
Thanks for your help - it worked! However....

It now brings back the value (in this case 111) as a weird format;

111.00:00:00

Ive formatted the number right, and the globalization settings are en-GB... is there something I have missed?

Thanks Again
Martin Stephenson
Martin Stephenson
SSC Eights!
SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)

Group: General Forum Members
Points: 894 Visits: 686
is the text box property set to date time ?
mark.johnson 26410
mark.johnson 26410
SSC-Enthusiastic
SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)

Group: General Forum Members
Points: 111 Visits: 9
Hi.

No, it is set to Number.

Also, the answer to my first question that I said it worked - actually didnt.
Martin Stephenson
Martin Stephenson
SSC Eights!
SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)

Group: General Forum Members
Points: 894 Visits: 686
Possibly try CInt(sum(Fields!DaysVoid, "dataset_name") ) - assuming daysvoid is calculated as part of the query ?
mark.johnson 26410
mark.johnson 26410
SSC-Enthusiastic
SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)

Group: General Forum Members
Points: 111 Visits: 9
No, it isnt - I think thats what the problem is.

In my dataset, i have "Start Date" and "End Date"

DaysVoid is a calculation of "End Date" subtract "Start Date"
Martin Stephenson
Martin Stephenson
SSC Eights!
SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)

Group: General Forum Members
Points: 894 Visits: 686
try
DateDiff("dd",Fields!StartDate.Value,Fields!StartDate.Value) to get the days void
Martin Stephenson
Martin Stephenson
SSC Eights!
SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)SSC Eights! (894 reputation)

Group: General Forum Members
Points: 894 Visits: 686
sorry that should read
DateDiff("dd",Fields!StartDate.Value,Fields!ENDDate.Value) to get the days void
mark.johnson 26410
mark.johnson 26410
SSC-Enthusiastic
SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)SSC-Enthusiastic (111 reputation)

Group: General Forum Members
Points: 111 Visits: 9
Nope... afraid not. Just get #error
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search