cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

BT Split on string within SQL statement

glen_bechtold
Newcomer

I would like to split a BT based on a string found in a SQL statement.

For the following SQL statement, I would like to split on the value of '1332055'

...WHERE (1=1) AND (t1.VAgreementOID = 1332055)) AND (t1.deleted = 'F')) and (t0.deleted = 'F')...

I already have  BT based on the SQL string, I just need to be able to split on this VAgreementOID value.

Is this possible?

5 REPLIES 5

graeme_william1
Inactive

Sure!

Without seeing the exact measure you're using for splitting, I'm guessing, but it looks like you need to add VAgreementOID = (\d*) to the transformation regex in your splitting measure.

-- Graeme

 

Thanks, but I don't see where I can reference database SQL when configuring the split measures.   Would this be done under Custom Bueinss Transaction Value?

graeme_william1
Inactive

Glen,

You said you already have a BT based on the SQL string.  Could you share that with us?

There's no built-in measure to capture the SQL String.  One way to do it is to put a method sensor somewhere the string is used in your code (for example, on the SQL prepare statement) and use the Method Argument Value measure to capture the string.  In that case, you can use the regular expression I gave above to parse out the value you want.

If you include a small session file in your response we can probably find the right method for you.

-- Graeme

jeff_rowell
Helper

I have a similar requirement - I wanted to create a BT to filter on transactions that have a specific SQL insert statement and then implement a splitting measure to count the number of calls to the insert statement based on a specific input colum. The intent was to count the number of errors of each type that were being logged to a DB via the insert statement. Based on the info above it does not sound like this is doable - I can easily filter a BT on the insert statements but there is no way, if I understand correctly, to create a splitting measure that would be based on the insert statement string... I just wanted to confirm this is correct before I give up.

Right. You would need to gather the splitting value from some other level, likely a method arg or return value in your code.