close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

What is the best way to create a simple rule based on a NULL recordset value?

Thread began 10/14/2012 7:41 pm by Lon Winters | Last modified 10/18/2012 4:25 pm by Lon Winters | 2141 views | 5 replies |

Lon WintersBeta Tester

What is the best way to create a simple rule based on a NULL recordset value?

I've always had trouble with this even when hand coding. I usually end up either putting in a default value in the database for comparison purposes, or create a recordset and perform the action depending on whether or not the recordset is empty. But I'd really like to do this, if possible the way the database is set up, and use the Rules manager.

I simply want to show the image is the recordset value for a particular field is not Null, and not show the image if the value is NULL.

When creating the Rule, I can either use Allow or Restrict. Which would e the best one and what would the comparison be to the recordset value?

I tried using Restrict, selected the recordset field, the Equals sign, and left the comparing field empty. This is what I do for Page access to check if the Sessions variable for a Logon ID is set and it works.

This time however, after the Rule is created, I select the Rule, and the image doesn't display although it should. I then tried selecting the "Not" version of the rule, and get an error

Parse error: syntax error, unexpected ';', expecting T_PAAMAYIM_NEKUDOTAYIM in /home/content/65/9860265/html/Profile_Preview.php on line 126

So, is it just not a good idea to rely on null values for these things? Or is there a better way to create the rule? I do understand the difference between NULL and something that just doesn't contain any data.

Sign in to reply to this post

Lon WintersBeta Tester

I've found the source of the error, but still can't get the rule right.

When I apply the behavior to the page, I notice in the code it's placing the HTM: markup for quotes around the rule name in the IF statement

<?php if(WA_Auth_RulePasses(&quot;MyRule&quot;))...

This also causes and error when I go to open the show Region dialog from the Server Behaviors panel - it says that the rule is no longer defined. So I change the markup to just regular quote symbols and all those errors go away. This does not happen when using Page Access. I'm using DWCS 4 on windows, and Sec Assist 1.1.9.

Is this a bug or a setting or just some random outcome because of a convergence of different things? Either way, it's not a big deal to work around, I'd still like to be ale to get my rule properly defined.

Sign in to reply to this post

Jason ByrnesWebAssist

Security Assist Access Rules cant be used for this.

you need to hand code the if statement for checking for null values:

php:
<?php if ("".$row_recordsetName['ColumnName']  ."" != NULL) { ?>

it's not null
<?php } else { ?>
It's Null
<?php ?>
Sign in to reply to this post

Lon WintersBeta Tester

Thank you Jason for once and again going above and beyond and providing the cole. I do understand what you mean, and I still don't like NULLs in any case, but I thought I would give it a go. Plus, I like using my tools whenever I can!

What about the error issue where the Rule name is enclosed in the &quot; markup and not the actual quote symbol?

And lastly, I did try using a default database value as a comparison for the rule in various combinations without success, but I will post a new thread on this if I need to.

Thanks again!

Sign in to reply to this post

Jason ByrnesWebAssist

  What about the error issue where the Rule name is enclosed in the &quot; markup and not the actual quote symbol?  



I've not been able to reproduce this, I would say it's a random fluke, if it happens again, let us know, and we'll start an incident to investigate.

Sign in to reply to this post

Lon WintersBeta Tester

Yeah, i would say random fluke too. i'll keep an eye on it, but the work around is simple enough and easier than to try an troubleshoot whatever combinations of code there is on the page that's probably contributing to it.

Overall, this part of Security Assist is one of my favorite tools to use - it really adds an element of professionalism to a site especially with the various options there are, such as using groups and being able to apply rules to multiple pages for larger sites.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...