I'm having some data coming through in an SSRS report as:
Mr John Smith (12, Livia Close, Anytown, 125765)
Can anyone advise on how I can remove the 'Mr John Smith' part and also the brackets around the address? I would like to just have:
12, Livia Close, Anytown, 125765
Any advice appreciated. Thanks.
Assuming your field is called Address use the following expression:
=Mid(Fields!Address.Value, InStr(Fields!Address.Value, "(") + 1, InStr(Fields!Address.Value, ")") - InStr(Fields!Address.Value, "(") - 1)
Related
Help with filter function!
I have a table with phone number and name as columns.
The JSON object would look something like this :
Details = [
{PN : '123-456-7890',
NAME : 'PERSON A',
},{
PN: '192-453-7655',
NAME: 'PERSON B',
}
]
I need to search on keyup and filter the data. The user can search in any of these patterns:
xxxxxxxxxx,
xxx-xxx-xxxx,
xxx-xxxxxxx,
xxxxxx-xxxx.
and still needs to get the data having xxx-xxx-xxxx as phone number in the table. Search should start as soon as the keyup triggers.
I tried using match and test methods, but couldn't make connection between search input, regex and the elements from table.
Can anyone suggest how I can tackle this situation?
Please use this regex -
/^\d{3}-\d{3}-\d{4}$|^\d{3}-\d{7}$|^\d{6}-\d{4}|^\d{10}$/
Angular Code -
matchNumber(){
var str = "12311111455";
var res = str.match(/^\d{3}-\d{3}-\d{4}$|^\d{3}-\d{7}$|^\d{6}-\d{4}|^\d{10}$/);
if(res.length > 0){
console.log('Matched);
}}
Valid Numbers
1234567890
123-456-7890
123-4567890
123456-7890
Invalid Numbers
123453647564756876
111223-234234
Check DEMO -
Check Valid Numbers
In this blog post Augusto showed that if I use double quotes like below
viewer.search('"GRIDPL 2 of GRIDFACES 1 of REFGRD /144CAGRIDS_E3D/WET-END"', (ids)=>{console.log(ids)}, ['Name']);
search is very fast. Yes, that's true. But when the attribute name is stored in a variable how can I use double quote?
I've tried several ways but no luck -
let s = "GRIDPL 2 of GRIDFACES 1 of REFGRD /144CAGRIDS_E3D/WET-END";
viewer.search('\'' + s + '\'', (ids)=>{console.log(ids)}, ['Name']) //[]
viewer.search('\'"' + s + '"\'', (ids)=>{console.log(ids)}, ['Name']) //[]
viewer.search(`'"${s}"'`, (ids)=>{console.log(ids)}, ['Name']) //[]
All the above gives empty array, like bellow image -
Could you please help?
TIA
You missed the last variant, and that's what you'd need:
viewer.search(`"${s}"`, (ids)=>{console.log(ids)}, ['Name'])
I'm looking for a groovy regex to be able to parse CSV file while ignoring commas insider double quotes.
The following regex works well in Java but not in Groovy:
it.split(",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)")
Would you please help me to solve this issue.
I want to validate a CSv file format, for example for following example, the format is correct or not:
Header1, Header2, Header3
1, 2, 3
4, "5, 6", 7
But in this case, the format is not valid:
Header1, Header2, Header3
1, 2
I check Groovy Split CSV but it didn't solve my problem. Because the solution shown in that article, after parsing following csv:
Header1, Header2, Header3
1, "2, 3", 4, 5
will match:
Header1: 1
Header2: "2, 3"
Header3: 4
and it ignores 5! But me, I want to print out a message that format is not correct.
Thanks in advance.
try to change it like this:
it.split(",(?=(?:[^\"]\"[^\"]\")[^\"]\${1})")
Let me know.
Tool: Microsoft Visual Studio 2013
I have an RDLC textbox expression where I want to split it based on ',' separated values and display those values in new line. For Example,
Value : Abc, Xyz, STU
The above value need to be displayed as :
Abc
Xyz
STU
I have tried the below expression:
IIf((Split(Parameters!rpField.Value,",").Length = 2),
Split(Parameters!rpField.Value, ",").GetValue(0) +System.Environment.NewLine+ Split(Parameters!rpField.Value,",").GetValue(1), "")
The result is #Error.
How can I accomplish this in SSRS?
Using the same structure you proposed, this worked for me:
=Split(CStr(Parameters!rpField.Value), ",").GetValue(0)
It looks like you just want to replace the commas with new lines, if you want them all in the same textbox?
If that is the case, you can simply use replace:
=replace("Abc, Xyz, STU", ", ", vbcrlf)
Have done it using Instr function and replaced ',' with NewLine as below:
=IIF(Parameters!rpField.Value <> "" ,iif(Instr(Parameters!Field.Value, ",") > 0 ,
" "+Replace(Parameters!rpField.Value,",",System.Environment.NewLine) +System.Environment.NewLine,
" "+Parameters!Field.Value+ System.Environment.NewLine) ,"")
Try this:
=JOIN(Split(Parameters!rpField.Value,","), System.Environment.NewLine)
I'm encountering an issue while develloping some report on RB.
I have a tablix that where the columns are the hours of the day, and the rows are different products. I also have a parameter with 3 values (AM, PM, NIGHT).
The point here is that if the parameter is set to AM, the tablix only display columns from 6 to 12, if it's set to PM, the tablix display from 12 to 18,...
I can display time intervals (6 to 12) by using filter where i tell him "Hour" IN "6, 7, 8, 9, 10, 11, 12". But it doesn't work when i set the filter value as following:
Expression: =Cstr(Fields!ProdHour.Value)
Operator: IN
Value:
=iif(join(Parameters!Shift.Value) = "AM",
"6, 7, 8, 9, 10, 11, 12" ,
iif(join(Parameters!Shift.Value) = "PM",
"13, 14, 15, 16, 17, 18",
iif(join(Parameters!Shift.Value) = "NIGHT",
"19, 20, 21, 22, 23, 0",
false)
)
)
Do you have any idea how I could solve this? Tried to change every number in Integer but didn't work...
I found a working solution:
I had to create 2 new fields in the same dataset as the table,I named those fields "ShiftStart" and "ShiftStop".
ShiftStart value : =iif(join(Parameters!Shift.Label)="AM","6",iif(join(Parameters!Shift.Label)="PM","12",iif(join(Parameters!Shift.Label)="NIGHT","0","0")))
Same with ShiftStop but with others values (12,18,0). So with those 2 data, when I pick "AM", ShitStart= 6 and ShiftStop=12, now i can create a filter to display columns where [Hour] is between [ShiftStart] and [ShiftStop].
Simple as that!
Thanks guys for you help! Sorry I can't Uptvote you, not enough reputation :(
I would suggest change the binding of your parameter like (ID,Value) see screen shot below
Now you can use the expression to get selected value
=Parameters!ReportParameter1.Value
You can also use below query to bind your dropdown, if don't want to hard code
Select ID,Value From
(Values('6,7,8,9,10,11,12','AM'),
('13,14,15,16,17,18','PM'),
('19,20,21,22,23,0','Night'))
tblTime(ID,Value)
I think that is what you are looking for
I would abandon using the In operator in the SSRS Filter Expression. I have only had universally bad experiences with Filters using any operator apart from "=" and also issues with datatypes.
My preference would be to filter this data out in the dataset query using SQL. However that is not the question.
In SSRS Filters, from hard experience, I now only always set datatype: "Boolean", operator: "=" and Value: "True". Then your challenge is to code an expression that only returns True for the rows you want to keep.
That could be something like:
=Iif ( ( Parameters!Shift.Value = AM and ("6,7,8,9,10,11,12").Contains(Fields!Hour.Value) )
Or ( ...
Is the Shift parameter multi-select?