Forum

HomeHomeCoreCoreBlue SkyBlue SkyRegion - Custom Condition ExecutionRegion - Custom Condition Execution
Previous
 
Next
New Post
10/28/2009 4:31 AM
 

Would it be possible to incorporate Custom Conditions against a region to prvent the region code from executing. Something like the image (edited in Firebug to show you what i'm on about).

I'm trying to prevent execution of certain regions if a DB error has occurred. (Or any detectable error for that matter). What i currently do is place an "if" test inside the region then indent all actions to prevent execution. This tends to bloat the code especially where you have nested queries. I thought that it would look neater if the condition was "behind the scenes".

While i'm on the subject, what is the best approach to exception handling? I'm curious how others tackle the problem. What i would love to see in OWS is a way to detect exceptions and pass control to an exception handler.

Cheers,
John.

New Post
10/28/2009 8:08 AM
 

I like... It's clean.

Although you'd want to notate that there's a custom condition in the admin summary, otherwise it might be difficult to determine why it's not executing. Also it would need some debug to state the results of the execution for debugging.

If your in SQL 2005+ you can use Try/Catch block and/or Transactions. We've been trying to work out a regular 'SQL Pattern' that uses both to catch most errors. (The exception is usually OWS Token Rendering errors, that create SQL Syntax Errors).

There is the [QueryName.isSuccessful,A] detection method, but it has limitations. (For instance the when importing .CSV to SQL you can't check line by line). But barring SQL syntax errors, the above covers most everything.

New Post
10/28/2009 11:40 AM
 
Why wouldnt you just make the region a child of an If condition?

Kevin M Schreiner
R2Integrated / Open Web Studio
New Post
10/31/2009 5:33 AM
 
Region
If AbortIndicator <> 'True'
. Query(MyQuery_1)
. . If AbortIndicator <> 'True'
. . . Query(MyQuery_2) - Execute for each row of Query 1.
. . . . actions for Query 2
. . . End-Query
. . . If '[MyQuery_2.isSuccessful,Action]' <> 'True'
. . . . Action Assign AbortIndicator = 'True'
. . . . Save Exception Message + Exception Handling
. . . End-If
. . End-If
. End-Query
.
. If '[MyQuery_1.isSuccessful,Action]' <> 'True'
. . . Action Assign AbortIndicator = 'True'
. . . Save Exception Message + Exception Handling
. End-If
End-If
End-Region

Hi Kevin, what i want to do is to hide some of the IF statements... against Regions and also against Query actions..

The pseudocode to the right is how i currently handle exceptions in nested query situations. I'll explain it inside out. The inner query MyQuery_2 is executed for every row of the outer query MyQuery_1. So if MyQuery_2 fails i want to get out of the whole region.

I dont want to keep executing MyQuery_2 for all the other rows of MyQuery_1. It would also be nice to prevent looping through the remainder of the rows in MyQuery_1 because the exception at MyQuery_2 may warrant a total abort.

In some cases i have many regions within a single region & what i would like to do is to remove some of the visual complexity of all of these if statements. Something like this is what i was thinking.

    Region
    • Region1 (if AbortIndicator <> 'true')
    • Region2 (if AbortIndicator <> 'true')
    • Region3 (if AbortIndicator <> 'true')
    • Region4 (if AbortIndicator = 'true')
    ...

Similarly, if it can be applied at region level then maybe also at Query level. Now having said all that i'm still not sure if i'm going about it the right way.. exception handling that is.

Cheers John

Previous
 
Next
HomeHomeCoreCoreBlue SkyBlue SkyRegion - Custom Condition ExecutionRegion - Custom Condition Execution


 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seatle, WA • 410.327.0007 • info@R2Integrated.com

Bookmark & Share Bookmark and Share