I am using Reporting Services 2005.
I need to calculate a "Payment Discount" by extracting information from a text field. The values in the field look like:
Net 30
1% Net 30
20% Net 60
If a % exists in the field I need to capture everything to the left of the % sign since the percentage can very in length. I tried the following in the SQL Data tab as part of a simple select statement. The syntax below is from MSDN but instead of returning the number(s) left of %, it returns "0" (because I specified Coalesce). Without Coalesce it returns nothing.
SELECT COALESCE(SUBSTRING(PAYMENT_TERMS_DESC, 0, CHARINDEX('%', PAYMENT_TERMS_DESC) -1),0) AS Expr1
FROM PO_HEADER
Any tips or suggestions would be greatly appreciated to get this running in SQL data view. If there's a better way to do this, like via an expression within the Layout view, I am open to suggestions.
Thank you!
I need to calculate a "Payment Discount" by extracting information from a text field. The values in the field look like:
Net 30
1% Net 30
20% Net 60
If a % exists in the field I need to capture everything to the left of the % sign since the percentage can very in length. I tried the following in the SQL Data tab as part of a simple select statement. The syntax below is from MSDN but instead of returning the number(s) left of %, it returns "0" (because I specified Coalesce). Without Coalesce it returns nothing.
SELECT COALESCE(SUBSTRING(PAYMENT_TERMS_DESC, 0, CHARINDEX('%', PAYMENT_TERMS_DESC) -1),0) AS Expr1
FROM PO_HEADER
Any tips or suggestions would be greatly appreciated to get this running in SQL data view. If there's a better way to do this, like via an expression within the Layout view, I am open to suggestions.
Thank you!