How to create serial number for each group in rdlc? - grouping

i have create a report with serial number using rownumber(nothing) in rdcl report. since, i have used a group in the report, the serial number is continued with the previous group
I get the report like
Group1 1 value 2 value
3 value
Group2 4 value 5 value
6 value
But i need it like
Group1 1 value 2 value
3 value
Group2 1 value 2 value
3 value
I even tried with RunningValue function. Is it possible the way i need it?

For creating serial number for each group in rdlc you can use following syntax
=RowNumber("table1_Group1") as expression in the text field
where table1_Group1 is group name .

Related

Jmeter remove brackets from results with regex

I have tis jdcb call results
[{string_agg=1268#jm_eo_2283,1343#jm_eo_2333}]
so i use this regex code to remove brackets (?<=[=]).*\d
In theory i should get only
jm_eo_2283,1343#jm_eo_2333
i have 2022-08-30 13:35:49,291 ERROR o.a.j.e.RegexExtractor: Error in pattern: '(?<=[=]).*\d'
Any idea what is going on?? Is a way to get the result without brackets??
According to the JDBC Request sampler documentation:
If the Variable Names list is provided, then for each row returned by a Select statement, the variables are set up with the value of the corresponding column (if a variable name is provided), and the count of rows is also set up. For example, if the Select statement returns 2 rows of 3 columns, and the variable list is A,,C, then the following variables will be set up:
A_#=2 (number of rows)
A_1=column 1, row 1
A_2=column 1, row 2
C_#=2 (number of rows)
C_1=column 3, row 1
C_2=column 3, row 2
So you should be able to access:
first row as ${eo_id_1}
second row as ${eo_id_2}
etc.
More information: Using JDBC Sampler in JMeter
You can use
=[0-9]*#(.*[0-9])
See the regex demo. Keep the template field set to $1$, it will extract the value captured with the first parenthesized pattern part.
Details:
= - a = sign
[0-9]* - zero or more digits
# - a # char
(.*[0-9]) - Group 1 ($1$): any zero or more chars other than line break chars as many as possible, and then a digit.

I'm not gettnig row number from grepl - doing this in R

I'm trying to determine which is the first row with a cell that contains only digits, "," "$" in a data frame:
Assessment Area Offices Offices Deposits as of 6/30/16 Deposits as of 6/30/16 Assessment Area Reviews Assessment Area Reviews Assessment Area Reviews
2 Assessment Area # % $ (000s) % Full Scope Limited Scope TOTAL
3 Ohio County 1 50.0% $24,451 52.7% 1 0 1
4 Hart County 1 50.0% $21,931 47.3% 1 0 1
5 OVERALL 2 100% $46,382 100.0% 2 0 2
This code does find the row:
grepl("[0-9]",table_1)
But the code returns:
[1] FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
I only want to know the row.
Your data could use some cleaning up, but it's not entirely necessary in order to solve your problem. You want to find the first row that contains a dollar sign and an appropriate value. My solution does the following:
Iterates over rows
In each row, asks if there's at least one cell that starts with a dollar sign followed by a specific combination of digits and commas (to be explained in greater detail below)
Stops when we reach that row
Prints the ID of the row
The solution involves a for loop, an if statement, and a regular expression.
First of all, here's my attempt to reproduce a data frame. Again the details don't matter too much. I just wanted to make the "money row" the second row which is kind of how it seems to appear in your example
df<- data.frame(
Assessment_Area = c(2,3,4,5),
Offices = c("#",1,1,2),
Dep_Percent_63016 = c("#","50.0%","50.0%","100.0%"),
Dep_Total_63016 = c("$ (000s)", "$24,451", "$21,931","$46,382"),
Assessment_Area_Rev = rep("Blah",4)
)
df
Assessment_Area Offices Dep_Percent_63016 Dep_Total_63016
1 2 # # $ (000s)
2 3 1 50.0% $24,451
3 4 1 50.0% $21,931
4 5 2 100.0% $46,382
Assessment_Area_Rev
1 Blah
2 Blah
3 Blah
4 Blah
Here's the for loop:
library(stringr)
for (i in 1:nrow(df)) {
if (any(str_detect(df[i,],"^\\$\\d{1,3}(,\\d{3})*"))) {
print(i)
break
}
}
The key is the line with the if statement. any returns TRUE if any element of a logical vector is true. In this case the vector is created by applying stringr::str_detect to a row of the df which is indexed as df[i,]. str_detect returns a logical vector - you supply a character vector and an expression to match in the elements of that vector. It returns TRUE or FALSE for each element in the vector which in this case is each cell in a row. So the crux of this is the regular expression:
"^\\$\\d{1,3}(,\\d{3})*"
This is the pattern we're searching for (the money cell) in each row. ^\\$ indicates we want the string to start with the dollar sign. The two backslashes escape the $ character because it's a metacharacter in regular expressions (end anchor). We then want 1-3 digits. This will match any dollar value below $1,000. Then we specify that the expression can contain any number (including 0) of , followed by three more digits. This will cover any dollar value.
Finally, if we encounter a row which contains one of these expressions, the for loop will print the number of the row and end the loop so it will return the lowest row number containing one desired cell. In this example the output is 2. If no appropriate rows are encountered, nothing will happen.
There may be more you want to do once you have that information, but if all you need is the lowest row number containing your money expression then this is sufficient.
A less elegant regular expression which only looks for dollar signs, commas, and digits would be:
"[0-9$,]+"
which is what you asked for although I don't think that's what you really want because that will match something like ,56$,,$$78

PowerBI - Get the Index of the First Occurance of a value in the column

I am trying to return the Index of a first occurrence of a value in a column.
I would want to use the Calculated Column functionality in PowerBI.
For Example,
Input Output
ASD 1
ASD 1
ASD 1
GEF 4
GEF 4
HIJ 6
GEF 4
This can be done in excel using a simple formula like,
MATCH(A2,A:A,0)-1
For PowerBI to understand Index, I have created a column called as Index on the Query editor and made the data look like,
Index Input Output
1 ASD ?
2 ASD ?
3 ASD ?
4 GEF ?
5 GEF ?
6 HIJ ?
7 GEF ?
How to do this in PowerBI?
The way I did this was to find the minimal index the corresponds to the Input value in the table:
Output = MINX(
FILTER(TableName,
TableName[Input] = EARLIER(TableName[Input])),
TableName[Index])
This takes the minimal index over the table, where Input matches the value of Input in the original (earlier) row context.

Remove "+" from output in SAS Content Catecorization

I got a little problem in SAS Content Categorization. I'm working with getting out two values. Value 1 and value 2.
I use predicate_rule, so when I click on the matched string in the program I get
ARGUMENT 0 [val1]: 4
ARGUMENT 1 [val2]: 4
ARGUMENT 2 [valName]: Score
In this example 4 is just an example of a value, but my problem is that when it stand 4+4 (no space between 4, + and 4) I can't get the latest value WITHOUT the plus symbol, so I get this out
ARGUMENT 0 [val1]: 4
ARGUMENT 1 [val2]: +4
ARGUMENT 2 [valName]: Score
I only manage to get the value printet correctly if there is space between the numbers and plus symbol.
I have now crateded two regex and two predicate_rules.
This one is for the first value (val1), called: Regex1
REGEX:[1-5]
This is for the seconed value (val2), called: Regex2
REGEX:\+[1-5]
I know that I get the plus symbol printed out because of Regex2, but I can't manage to get the latest value without typing it this way.
In the main concept I have created two predicate_rules. One that should manage the score which have space between the numbers and the plus symbol, and one that should manage when there is no space between.
#With space
PREDICATE_RULE:(valName,val1,val2):(ORDDIST_4, "_valName{valName}", "_val1{Regex1}", "+", "_val2{Regex1}")
#Without space
PREDICATE_RULE:(valName,val1,val2):(ORDDIST_3, "_valName{valName}", "_val1{Regex1}", "_val2{Regex2}")
valName only contains terms that should be in distance of the arguments so it matches correctly.
Thanks in advance.
I think you can look at altering your 2nd regex in the predicate_rule. Since you mentioned that text pattern like 4+4 is an issue. You could probably look into Positive lookbehind to solve the issue. Positive lookbehind will help you to select your group before your main expression without including it in the result.
Pattern like below could easily solve by Positive lookbehind:
4+4
4 + 4
4 +4
4 4
Try the following regex for the 2nd predicate_rule :
(?<=[\+ ])[\d]

regex: extract 3 specific numbers from a string | example

given the following 2 lines of strings, for example :
May 22 00:46:38.340 prod-lab03c-rd1 fpc4 XETH(4/2): %PFE-6: Link 0 XFP: Low Rx power warning set
[May 24 11:24:28.299 LOG: Notice] MIC(0/1) link 1 SFP receive power low warning set
i would like to store in 3 variables the following numbers :
[1] the 1st number after the "(", it could be 1 or more digits
[2] the 1st number after the "/", it could be 1 or more digits
[3] the first number after the "(L|l)ink" word, it could be 1 or more digits
could you please assist me on this please ?
many thanks
To get the first number after the first (, we can use .*\((\d+). Then to get the first number after the /, we can use /(\d+)\). And then to get the first number after "link": [lL]ink (\d+). We put these together to get
^.*\((\d+)/(\d+)\).*[lL]ink (\d+)
The three numbers will be in the three groups
This works here
\((.*?)/(.*?)\).*?[Ll]ink (\d+)
Give your input it will give back
group 1 group 2 group 3
4 2 0
0 1 1
A full tested example in Perl :
#!/usr/bin/env perl
use strict;
use warnings;
my #a;
$a[0] = "May 22 00:46:38.340 prod-lab03c-rd1 fpc4 XETH(4/2): %PFE-6: Link 0 XFP: Low Rx power warning set\n";
$a[1] = "[May 24 11:24:28.299 LOG: Notice] MIC(0/1) link 1 SFP receive power low warning set";
foreach (#a) {
print "\$1=$1|\$2=$2|\$3=$3\n" if m!\((\d+)/(\d+)\).*?(?:L|l)ink\s+(\d+)!;
}
The output :
$1=4|$2=2|$3=0
$1=0|$2=1|$3=1