1
votes

I'm trying to build a bank file using SSRS report builder (3.0). I'm running into two issues:

  1. I'm trying to get a length expression to work on a check number field but LEN(Field) doesn't work (returns 4 as the value regardless of the actual length of the field).

And LENGTH(Field) gives me an error:

The Value expression for the textrun 'Textbox15.Paragraphs[0]. TextRuns[0\' contains an error: [BC30451] Name 'LENGTH' is not declared*

  1. The only reason why I'm even trying to get #1 to work is because I need to have one of the fields on the bank file have a constant length. Regardless of the check number, I need to make sure this field is always at 14 characters with leading zeros. I thought the best way to do this is to do a switch statement and add the number of appropriate zeros in depending on the size of the check number field.

Thanks for the help.

Edit: using a SQL server DB

2

2 Answers

1
votes

For the length issue:

There are two ways to get string length

Using the LEN function

= LEN(Fields!myfield.Value)

Using the length property

= Fields!myfield.Value.Length

If your field is not a string, try converting first by using the Cstr function

= LEN( Cstr(Fields!myfield.Value) )
= Cstr(Fields!myfield.Value).Length

For the formatting issue:

For numeric fields set the cell format expression to have as many zeros as required eg. for 14 digit numbers

= "00000000000000"
0
votes

I don't know on which database you are working if you are using sql server then try LEN function and LENGHT in oracle.

I think you first convert it into integer if it's character and then try len function.