Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use SWITCH to Format Strings and Ints?

Status
Not open for further replies.

thermidor

Programmer
Nov 28, 2001
123
US
Hi all:

I have a query that returns strings. However, I would like to conditionally format the data as a string or int. The following renders "# Error" in my report when it encounters data I want to format as string.

=Switch(
Fields!SORT_FLAG.Value=0,Fields!C1.Value,
Fields!SORT_FLAG.Value=1,Fields!C1.Value,
Fields!SORT_FLAG.Value=2,CInt(Fields!C1.Value))

Can anyone explain this and/or suggest how to get the result I want?

TIA,
Sven
 
String and Int are datatypes, so I'm not sure how you format something as a datatype. Furthermore, format functions usually operate on non-character data to return character data. For example, a decimal to a string, a date to a string, an integer to a string, etc.

Can you post some sample data and expected results?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top