i am using conditional formatting in my report, my report has 4 columns as below
table1- count, table2- count, table3-count, table4-count
4, 5, 6 ,7
4,4,4,4
what I need is if any of the counts do not match it should show in red, when I use conditional formatting it uses [AND] that's why it's not working.
can anyone help?
Related
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.
This is the original data, all the data are of two kinds: red and black. And then, I want to study the occurrence of all the blocks. The result will be like this:
It means the first streak of red(from index 1 to 3) has a length of 3, and the second streak which is black(from index 4 to 5) has a length of 2...
I want to find out an elegant way to calculate it but in sheets, it's very hard. COUNTIF and ROWS all can't perfectly resolve this problem.
Do you have an elegant way?
try:
=ARRAYFORMULA(QUERY(REGEXREPLACE(QUERY({TEXT(
VLOOKUP(ROW(B2:B20), QUERY((B2:B20<>B1:B19)*ROW(B2:B20),
"where Col1 <>0"), 1, 1), "000000")&"×"&B2:B20},
"select Col1,count(Col1) group by Col1 label count(Col1)''")&"", "(.+×)", ),
"where Col1 is not null"))
Not sure it's elegant, but you could add two helper columns, the first column checks if the record has changed, and the second counts until the next change using a MATCH. Note you'd need an extra "TRUE" below the last record to catch the last streak. Then you can use FILTER to show the blocks and occurances.
I have a range of columns that may or may not have symbols after a numeral (e.g. 3, 4, 2++, 1-) and my goal is to strip any non-number characters and provide a sum of the whole shebang.
=ARRAYFORMULA(REGEXEXTRACT($B$21:$I$21, "[0-9]+"))
The above gives me an appropriate list of cells (continuing the above examples, I'd get the following values in separate cells: 3, 4, 2, 1).
Now when I try and sum it up I get an error or it just plain gives me 0 as the result.
=SUM(ARRAYFORMULA(REGEXEXTRACT($B$21:$I$21, "[0-9]+")))
and
=ARRAYFORMULA(sum(REGEXEXTRACT($B$21:$I$21, "[0-9]+")))
Both return 0.
regex converts numbers to text strings so you need to do:
=ARRAYFORMULA(SUM(REGEXEXTRACT($B$21:$I$21&"", "[0-9]+")*1))
I have a column (Column A) of cells with tracking information. Each cell contains the date shipped and a tracking number. I have another column (Column B) with a bunch of tracking numbers. How can I see if the tracking number in column B match any of the tracking numbers in Column A?
This is what I have tried:
=IF(RegExMatch(A1, TO_TEXT(B:B)),"YES","NO") but that's not working
All of the results are coming back as "YES" even though there is no match. Any thoughts on this?
=ARRAYFORMULA(IF(LEN(B:B), IF(IFERROR(VLOOKUP(""&B:B,
IFERROR(REGEXEXTRACT(A:A, TEXTJOIN("|", 1, B:B))), 1, 0))<>"", "YES", "NO"), ))
I have a set of strings containing a minimum of 1 and a maximum of 3 values in a format like this:
123;456;789
123;123;456
123;123;123
123;456;456
123;456;123
I'm trying to write a regular expression so I can find values repeated on the same string, so if you have 123;456;789 it would return null but if you had 123;456;456 it would return 456 and for 123;456;123 return 123
I managed to write this expression:
(.*?);?([0-9]+);?(.*?)\2
It works in the sense that it returns null when there are no duplicate values but it doesn't return exactly the value I need, eg: for the string 123;456;456 it returns 123;456;456and for the string 123;123;123 it returns 123;123
What I need is to return only the value for the ([0-9]+) portion of the expression, from what I've read this would normally be done using non-capturing groups. But either I'm doing it wrong or Oracle SQL doesn't support this as if I try using the ?: syntax the result is not what I expect.
Any suggestions on how you would go about this on oracle sql? The purpose of this expression is to use it on a query.
SELECT REGEXP_SUBSTR(column, "expression") FROM DUAL;
EDIT:
Actually according to https://docs.oracle.com/cd/B12037_01/appdev.101/b10795/adfns_re.htm
Oracle Database implements regular expression support compliant with the POSIX Extended Regular Expression (ERE) specification.
Which according to https://www.regular-expressions.info/refcapture.html
Non-capturing group is not supported by POSIX ERE
This answer describes how to select a matching group from a regex. So using that,
SELECT regexp_substr(column, '(\d{3}).*\1', 1, 1, NULL, 1) from dual;
# ^ Select group 1
Working demo of the regex (courtesy: OP).
If you only have three substrings, then you can use a brute force method. It is not particularly pretty, but it should do the job:
select (case when val1 in (val2, val3) then val1
when val2 = val3 then val2
end) as repeated
from (select t.*,
regexp_substr(col, '[^;]+', 1, 1) as val1,
regexp_substr(col, '[^;]+', 1, 2) as val2,
regexp_substr(col, '[^;]+', 1, 3) as val3
from t
) t
where val1 in (val2, val3) or val2 = val3;
Please bear with me and think of this different approach. Look at the problem a little differently and break it down in a way that gives you more flexibility in how you you are able look at the data. It may or may not apply to your situation, but hopefully should be interesting to keep in mind that there are always different ways to approach a problem.
What if you turned the strings into rows so you could do standard SQL against them? That way you could not only count elements that repeat but perhaps apply aggregate functions to look for patterns across sets or something.
Consider this then. The first Common Table Expression (CTE) builds the original data set. The second one, tbl_split, turns that data into a row for each element in the list. Uncomment the select that immediately follows to see. The last query selects from the split data, showing the count of how often the element occurs in the id's data. Uncomment the HAVING line to restrict the output to those elements that appear more than one time for the data you are after.
With the data in rows you can see how other aggregate functions could be applied to slice and dice to reveal patterns, etc.
SQL> with tbl_orig(id, str) as (
select 1, '123;456;789' from dual union all
select 2, '123;123;456' from dual union all
select 3, '123;123;123' from dual union all
select 4, '123;456;456' from dual union all
select 5, '123;456;123' from dual
),
tbl_split(id, element) as (
select id,
regexp_substr(str, '(.*?)(;|$)', 1, level, NULL, 1) element
from tbl_orig
connect by level <= regexp_count(str, ';')+1
and prior id = id
and prior sys_guid() is not null
)
--select * from tbl_split;
select distinct id, element, count(element)
from tbl_split
group by id, element
--having count(element) > 1
order by id;
ID ELEMENT COUNT(ELEMENT)
---------- ----------- --------------
1 123 1
1 456 1
1 789 1
2 123 2
2 456 1
3 123 3
4 123 1
4 456 2
5 123 2
5 456 1
10 rows selected.
SQL>