?
Solved

SSRS Expression Help

Posted on 2008-10-14
10
Medium Priority
?
988 Views
Last Modified: 2012-05-05
Could anyone help me figure out how to perform these expressions in SSRS?  They were originally in Crystal Syntax:

truncate({CHECKMAST.CHECKAMT});
replicatestring("0", 8 - length(totext(dollars, 0, "", "")));
0
Comment
Question by:chrisryhal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
10 Comments
 
LVL 12

Expert Comment

by:jgv
ID: 22713935
For the truncate: Math.Truncate(Fields!ANumberField.Value)
To replicate a character: Strings.StrDup(8, "0")

Not entirely sure how to convert the second line fully. It would help to see an example of what the value would look like before and after in crystal
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22714155
0
 
LVL 12

Expert Comment

by:jgv
ID: 22714461
Thanks mlmcc. The questions are related but there are some differences. Stepping out on a limb (and not being entirely sure of the output of the "totext" function) the SSRS translation would be:
=Strings.StrDup(8 - Math.Truncate(Fields!CHECKAMT.Value).ToString.Length, "0")

chrisryhal, if this is not what you are looking for you will need to follow up. Again, it's helpful to see what the value would be before and after.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 101

Expert Comment

by:mlmcc
ID: 22714681
As used the ToText function converts the dollar figure to text with 0 decimal places and no thousand separator.

Check the VB CStr or ToText function.

mlmcc
0
 
LVL 12

Expert Comment

by:jgv
ID: 22715015
Based on your explanation my last example should work then. I'm aware of the CStr function in VB but I haven't seen "ToText" in VB or .NET (just looked). Perhaps in a library/assembly that has to be loaded first?
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22715350
ToText is prpobabl;y the Crystal functiion for CStr.

mlmcc
0
 
LVL 2

Author Comment

by:chrisryhal
ID: 22757718
Below is the entire Crystal Syntax.  I seem to be OK until it gets to the "dollarfill" in the expression which is what I don't understand how to do in SSRS.




stringvar transaction;
stringvar action;
 
stringvar acctnumfill := replicatestring("0", 10 - length({CHECKMAST.BANKACCTNUM}));
stringvar checknumfill := replicatestring("0", 10 - length(totext({CHECKMAST.CHECKNUM}, 0, "", "")));
numbervar dollars := truncate({CHECKMAST.CHECKAMT});
numbervar cents := truncate((remainder({CHECKMAST.CHECKAMT},1) * 100),2);
stringvar dollarfill := replicatestring("0", 8 - length(totext(dollars, 0, "", "")));
stringvar centfill := replicatestring("0", 2 - length(totext(cents, 0, "", "")));
 
 
 
"876" + acctnumfill + {CHECKMAST.BANKACCTNUM} + " " + transaction + action + 
" " + checknumfill + totext({CHECKMAST.CHECKNUM}, 0, "", "") + 
dollarfill + totext(dollars, 0, "") + centfill + totext(cents, 0, "") +
totext({CHECKMAST.CHECKDATE}, "MMddyy") +
"                                  "

Open in new window

0
 
LVL 12

Accepted Solution

by:
jgv earned 2000 total points
ID: 22758900
This should do it. Based on what I am seeing in your crystal formula, this should roll the calculation for "dollars" and "dollarfill" into one expression.
=Strings.StrDup(8 - Math.Truncate(Fields!CHECKAMT.Value).ToString.Length, "0")
0
 
LVL 2

Author Comment

by:chrisryhal
ID: 22767162
jgv:   StrDup is an unrecognized identifier
0
 
LVL 2

Author Comment

by:chrisryhal
ID: 22767176
jgv:   nevermind, I got it.  

StrDup(8 - Math.Truncate(Fields!CHECKAMT.Value).ToString.Length, "0")

Appears to of worked!!!

THANK YOU THANK YOU
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question