I'm stuck here. Everytime I concatenate SSRS textbox, the concatenation adds a new line. I use a Microsoft SQL 2013 database. Here is my expression that I use to concatenate.
=First(Fields!FirstName.Value, "DataSet1") & " " & First(Fields!LastName.Value, "DataSet1)
What happens is that there is a new line placed after the first name making the final output look like this.
FirstName
LastName
If anyone has any suggestions that would be great. I tried googling the problem and I couldn't find an answer. Please someone help.
Try using a variable under Report/Report Properties or even concat it on the query end...it may be easier
Perhaps you have leading/trailing spaces. Try using LTRIM or RTRIM.
=First(LTRIM(RTRIM(Fields!FirstName.Value)), "DataSet1")
& " " & First(LTRIM(RTRIM(Fields!LastName.Value)), "DataSet1)
I have found what was wrong. I had to select my expression (Expr). Then in the properties tab, I changed the Markup Type to HTML and that fixed my problem.
Thank you everyone for your time and effort.
Related
Hello on excel i have big data.Is only one column the data and i want split by tags "{" and "}". On column the image is like that:
{{[math1];1;1;5.6617};{[math2];1;1;34.3131};{[math3];1;1;4.5293}}
If i format the text is like that:
{
{[math1];1;1;5.6617}; //Math1
{[math2];1;1;34.3131}; //Math2
{[math3];1;1;4.5293} //Math3
}
i want split //Math1 , //Math2 & //Math3
The data is from SQL server maybe help this. I can use any tool extra on excel for data model?
Following should be helpful though not sure its the best way to solve your problem.
For first part i.e. Math1, use the following formula
=MID(A1,2,SEARCH("};",A1,1)-1)
For second part i.e. Math2, use the following formula
=MID(A1,SEARCH("};",A1,1)+2,SEARCH("};",A1,SEARCH("};",A1,1)+1)-SEARCH("};",A1,1)-1)
For third part i.e. Math3, use
=MID(A1,SEARCH("};",A1,SEARCH("};",A1,1)+1)+2,LEN(A1)-SEARCH("};",A1,SEARCH("};",A1,1)+1)-2)
See image for reference
I'm using a regex to validate a form input. So basically a user can input "SELECT some_name of select_match".
So far I have the regex: \bSELECT\b \bof select_match\b
The last part is the middle part, which I think should be [a-zA-Z] but I'm not sure how to place it in the middle. I've read multiple pages but can't get it to work.
Also preferably I'd like the regex to ignore spaces between "SELECT" and of "select_match". Meaning that SELECT blabla of select_match and SELECT blabla of select_match would both be validated as correct.
Can anyone tell me how to do this? Thank you.
If I understood you correctly, this should work:
/^SELECT\s+(\w+)\s+of select_match$/
Notes:
This allows any number of spaces between "SELECT" and the match_name; and between the match_name and the "of" (but, at least 1. To change to at least 0, change the \s+ to a \s*)
After that, the rest of the string must be exactly like that (same spaces and words exactly).
The match_name will be in match group 1.
If this doesn't work, show a bit of your code (where you use it) and we can try to find the problem.
Note: If you are using it in ng-pattern lose the "/"s (being the pattern: ^SELECT\s+(\w+)\s+of select_match$).
Note2: If you are using it in a string, remember you might need to escape every "\" (making it a "\", and the result: ^SELECT\\s+(\\w+)\\s+of select_match$
Above is a database that i am uploading to a hosting server to pull the data off of it to a website using .asp code in a HTML file. The sensors field gets the data using lookup from another table and can contain multiple values but these values are separated using a comma ",". I was wondering if there was a way either within the database or on the .asp page to get rid of the comma and sort them in a new paragraph or replace the "," with "< br/ >" between each of the sentences
NOTE CHANGE TO ORIGINAL QUESTION
The original question was in reference to ASP.NET. After providing a thorough answer it transpired that the author was actually using VBScript and Classic ASP. The final update to this answer reflects his change.
I have left my original answer just in case it helps someone else with the same issue as originally asked..
===================================
Replace won't be enough if you want to change any of the order; I.E alphabetically.
One way would be to put the Database string into a list, splitting it at the comma. you can then output this list in any order you want.
For example.
to Split into a list
List<string> myList = yourSensorsString.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
You can then order this however you see fit. Something like:
myList.Sort();
Then simply go through each of the items, like - where myLbl is perhaps a label control on your page
foreach ( str in myList) {
myLbl.Text += str + "<br />";
}
Or as separate paragraphs, maybe into a Literal
foreach ( str in myList) {
myLit.Text += "<p>" + str + "</p>";
}
Update
This code example above would be placed in your code-behind. You would get your sensors string from the database, and then split it into a list, then output to the HTML. No need to get your database to perform this sort of logic.
I have also assumed C# as you never mentioned what flavour of .net you're using.
Update 2
After looking at your fiddle, i edited it slightly to show where you can use this sort of code. Also converted my code to VB. Hope this helps. Can't put any more time into this... Fiddle Is Here
Update 3
The original question was for ASP.NET - as it turns out, it's actually Classic ASP the OP is asking about.
So split your string like this:
myList=Split(rsLogbook("FieldName"), ",")
for each str in myList
document.write(str & "<br />")
next
Other than that, I can't help any further - lot of time spent on this :)
I want to add a LIKE filters with wildcards in SSRS report builder. I tried this using contains clause present in filter data section of report builder. I tried both '*' and '%', but of them failed.
I tried
MyFieldName contains 2451 - this succeds
MyFieldName contains 24* - this fails
MyFieldName contains 24% - this fails
From below link I feel that this is an old problem with no solution till yet.
http://connect.microsoft.com/SQLServer/feedback/details/202792/ssrs-adding-like-filter-criteria-to-report-builder
What do you guys suggest?
Thanks
Ravi Gupta
You could use the InStr function
=IIF(InStr(Fields!MyFieldName.Value, "2451"),TRUE,FALSE)
In SSRS we can't use Like. Instead of which you can use Contains.
IIF((MyFieldName).ToString().Contains("RequiredString"),"True","False)
In the report builder in Visual studio there is a Like and it works. Use a * as wildcard in your search string
Answering my own question, Below function worked for me:
IF(FIND(MyFieldName, "24") = 1, TRUE, FALSE)
This is just a partial answer as this will work for cases like (blabla*), but its not for cases like (bla*bla, blabla*). So anyone having a better idea is most welcome.
Got idea to do this from Darren's comment above.
Thanks
Ravi Gupta
The Report Builder does not support the LIKE operator. You must use CONTAINS;
This is pretty late to the party, but I worked out a solution for parameter filters for my dataset.
Adding a filter to my dataset with
Expression:
=IIF(InStr(Fields!AccountName.Value, Parameters!paramAccountName.Value) OR Parameters!paramAccountName.Value = "*", TRUE, FALSE)
Type
Boolean
Operator
=
Value
true
The parameter are defaulted to "*" so the report looks like it grabs everything by default.
I just came across this old thread and I'm curious why you can't use the like keyword, since I've always used it.
Did you try something like this?
Where (AccountName like '%' + #paramAccountName + '%' or #paramAccountName ='')
I am trying to query from search box using list of data and the linq I used is:
data = (From k As BSPLib.ContactLib.Contact In data_org.Values Where k.stringdata Like "%" & Searchtxtbox.Text & "%" Select k.prime).ToList
But this is not working, I am getting no data at all. Data_org is a dictionary so I used the values; k.stringdata contains all the data that need to be searched. Searchtxtbox.text contains the user defined search item.
I Tried with sqlmethods through linq, but sqlmethods does not exist for me, I tried with with Imported namespace yet the code is not showing sql methods, could you please provide a workable query or just tell me where I have gone wrong. Thank you.
My Visual Basic is a bit rusty so forgive me if I have the syntax wrong:
One thing you could use is Contains which will be similar to "%Searchtxtbox.Text%"
and exactly the same if it is used with a DatabaseContext.
I know it is not the same as Like but if that doesn't work than likely something else is wrong and than I would like more code.
data = (From k As BSPLib.ContactLib.Contact In data_org.Values Where k.stringdata.Contains(Searchtxtbox.Text) Select k.prime).ToList
You can additionally use StartsWith and EndsWith for "Searchtxtbox.Text%" and "%Searchtxtbox.Text"
Also would I like to suggest to puth "%" & Searchtxtbox.Text & "%" between Parentheses for clarification, but that's all up to you.
The % wildcard character won't work here, remember this is .NET code, not SQL. You need something like this instead:
data = (
From k As BSPLib.ContactLib.Contact In data_org.Values
Where k.stringdata.Contains(Searchtxtbox.Text) Select k.prime).ToList