I have an SSRS report that takes a parameter called Customer ID Enroller List. Its datatype in SSMS is varchar(max) and its datatype in SSDT/SSRS is listed as text.
As an example, the user may pass in 2 customerID's like the following:
2110012639,2110179997
I'd like to create document map based the passed parameters but I need to split the values first. I've tried using the following code:
=Split(Parameters!CustomerID_EnrollerList.Value,",")
My report runs but the value returned in the textbox is #Error. Any ideas on how to split a text datatype parameter by a comma delimiter?
Split function returns an array and you can select item by its index
First value would be
=Split(Parameters!CustomerID_EnrollerList.Value,",")(0)
And Second value would be
=Split(Parameters!CustomerID_EnrollerList.Value,",")(1)
Related
I am parsing a string which contains a (money) value in a varchar format.
Formatting is always like this: 12345,75 (varchar). Another input value could thus be 32323232,98 and so on...
Desired output = 12.345,75 (doesn't have to be output as a varchar).
So what I need is dots as thousand separators, and a comma for separating the two decimals (input value always has 2 decimals).
My attempt:
DECLARE #Num varchar(50)
SELECT FORMAT(CONVERT(numeric(10,2), REPLACE(#Num,',','.')), #Num, '#.00')
Error:
The culture parameter '#.00' provided in the function call is not supported.
Using MS SQL Azure 2019
The 'nl-nl' culture does exactly what you want. So, try using the third argument to format():
select format(1234567.888, '#,#.00', 'nl-nl')
I want to add multiple value to a single crystal report parameter separated with commas. I am able to pass all values of parameter including multiple one from my vb.code to crystal report. Now when I try to download the report it combines the comma separated values in to one. For example, if I pass id 1,2,3 to parameter #id it downloads the report of ID 123 instead of reports of ID 1, 2 and 3
Dim IDS As Integer
IDS = Request.QueryString("ids")
crReportDocument.SetParameterValue("#ids", ids)
If I write IDs in manually like
crReportDocument.SetParameterValue("#ids", "1,2,3,4")
it works fine but when the parameter #ids,ids is given it gives me the report of id no 1234 not 1,2,3,4.
When i try these parameters in crystal reports application directly it works fine there. It also works fine in sql procedures when i execute that procedure.
Thanks for those who at least viewed my question. changed the datatype of ids from integer to string
Dim IDS As Integer
Dim IDS As String
Solved the Problem. The integer was omitting the comma
I just created 2 cross table using wizard function of Telerik Standalone report designer tool
since ISCED 5 has values for private and public its showing properly
using same query I created second cross tab and
but since ISCED 6 table doesnt have values for "public" section its showing like this
how to show as zero for public section 2nd cross tab (when no values for specific row)
You should modify the value of the field using an expression to evaluate your condition.
Select the textbox containing the data corresponding to the column you like to format when the value is null.
In the property pan on the right select "Value"
Write in there your expression, it should be something like this:
=Iif(Fields.MyField IS Null,"0",Fields.MyField)
You should also consider if the value instead of null is empty and eventually cover this case in the expression if applicable.
= Iif(Fields.MyField IS Null OR Fields.MyField = "", "0", Fields.MyField)
More information on conditional formatting can be found here.
Let us know if this works for you.
I have a report in 2005 SSRS which I want to add a parameter to. The parameter would be comprised of a group of zip codes, but be selected as a single item in the list.
For example, I would like to have 5 zip codes as one selection in the list and 3 for another, etc:
Select 11111,22222,33333,44444,55555,66666 AS Boondock
Select 77777,88888,99999 AS Timbuck
Select Zip Codes NOT IN (11111-99999) AS Everything Else
So my selections in the dropdown would be:
Boondock
Timbuck
Everything Else
Can anyone help me with how I should go about creating this parameter?
Create a simple string parameter to present to the user. Let's call it ZipCodeSet.
Create a dataset that examines the #ZipCodeSet parameter and returns the appropriate list of zip codes. Call it ZipCodeSelection.
Create an internal multivaue parameter that uses ZipCodeSelection as both its Available Values and Default Values. Call it SelectedZipCodes.
Use SelectedZipCodes in your report's datasets.
The easiest solution here would probably to use a Calculated Field on your dataset, called LocationDescription, for example:
=SWITCH(Fields!ZipCode >= 11111 and Fields!ZipCode <= 66666, "Boondock", Fields!ZipCode >= 77777 and Fields!ZipCode <= 99999, "Timbuck",True, "Everywhere Else")
The lone true statement at the end is due to the SWITCH expression reading left-to-right and exiting once it evaluates one of the switches as TRUE. This way for each of the items in your table of ZipCodes you will always end up with a TRUE result.
I assume you're evaluating a range of ZipCodes, and not exact values of 11111,22222, and so on? If so, the switch will have more values. A sample of your data would help if you want an exact answer.
Once you have built your Calculated Field, you can then set up a Parameter (called #LocationParameter) with available values based on a query of your LocationDescription field, then just filter your dataset using:
Expression:
= Fields!LocationDescription
Operator: =
Value:
#LocationParameter
(if you want multiple selections on your parameter, change the operator to IN)
Hope that helps.
I import Excel files via SSIS to SQL-Server. I have a temp table to get everything in nvarchar. For four columns I then cast the string to money type and put in my target table.
In my temp table one of those four columns let me call it X has a comma as the delimiter the rest has a dot. Don't ask me why, I have everything in my SSIS set the same.
In my Excel the delimiter is a comma as well.
So now in my target table I have everything in comma values but the X column now moves the comma two places to the right and looks like this:
537013,00 instead of 5370,13 which was the original cell value in the temp and excel column.
I was thinking this is a culture setup problem but then again it should or shouldn't work on all of these columns.
a) Why do I receive dot values in my temp table when my Excel displays comma?
b) how can I fix this? Can I replace the "," in the temp table with a dot?
UPDATE
I think I found the reason but not the solution:
In this X column in excel the first three cells are empty - the other three columns all start with 0. If I fill these three cells of X with 0s then I also get the dot in my temp table and the right value in my target table. But of course I have to use the Excel file as is.
Any ideas on that?
Try the code below. It checks whether the string value being converted to money is of numeric data type. If the string value is of numeric data type, then convert it to money data type, otherwise, return a NULL value. And it also replaces the decimal symbol and the digit grouping symbol of the string value to match the expected decimal symbol and digit grouping symbol of SQL Server.
DECLARE #MoneyString VARCHAR(20)
SET #MoneyString = '$ 1.000,00'
SET #MoneyString = REPLACE(REPLACE(#MoneyString, '.', ''), ',', '.')
SELECT CAST(CASE WHEN ISNUMERIC(#MoneyString) = 1
THEN #MoneyString
ELSE NULL END AS MONEY)
As for the reason why you get comma instead dot I have no clue. My first guess would be cultural settings but you already checked that. What about googling, did you get some results?
First the "separator" in SQL is the decimal point: its only excel that is using the comma. You can change the formatting in excel: you should format the excel column as money and specify a decimal point as the separator. Then in the SSIS import wizard split out the transformation of the column so it imports to a money data type. Its a culture thing, but delimiter tends to be used in the context of signifying the end of one column and the start of the next (as in csv)
HTH
Well thats a longstanding problem with excel. It uses the first 30 or so rows to infer data type. It can lead to endless issues. I think your solution has to be to process everything as a string in the way Yaroslav suggested, or supply an excel template to have data predefined and formatted data type columns, which then have the values inserted. Its a pita.