Jump to content
Server Maintenance This Week. ×

Correct way to limit Records in Privilege Set?


This topic is 4022 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have a PHP web published site using a FMStudioPro built site and I am getting errors whenever I try to make its user have custom privileges limited to a field (called "On Web") that is a boolean.  I have tried

 

On Web = 1

and

On Web = "1"

and

On Web > 0

 

All I get is that every page on the site jumps to the error page - 404 No records match request

 

I am trying to limit the web results to just records that have the checkbox "On Web" checked.  If I remove Custom Privileges, the site works fine, but of course returns all the database's records.

 

thank you!

 

-- Don

Link to comment
Share on other sites

Hello - thank you for the reply -- only thing is I don't seem to be able to get the criteria to work -- I try to limit the results to just the field "On Web" to have a boolean value of 1 with this at the head of the search page - but it always returns everything...:

 

 

<?php

$found_records_find = $macusa->newFindCommand('Web Browse View');

$found_records_findCriterions = array('On Web'=>'=='.@($_REQUEST['On_Web']),);

foreach($found_records_findCriterions as $key=>$value) {

   $found_records_find->AddFindCriterion($key,$value);

}

 

fmsSetPage($found_records_find,'found_records',20); 

 

$found_records_result = $found_records_find->execute(); 

 

if(FileMaker::isError($found_records_result)) fmsTrapError($found_records_result,"error.php"); 

 

fmsSetLastPage($found_records_result,'found_records',20); 

 

$found_records_row = current($found_records_result->getRecords());

 

// FMStudio Pro - do not remove comment, needed for DreamWeaver support ?>

Link to comment
Share on other sites

Is the value of 'On_Web' passed in a form or URL? If not, it will be null, so making the request for find everything...

 

Testing version:

<?php
$found_records_find = $macusa->newFindCommand('Web Browse View');
$onWeb = 1;
$found_records_findCriterions = array('On Web'=>'=='.$onWeb,);
foreach($found_records_findCriterions as $key=>$value) {
   $found_records_find->AddFindCriterion($key,$value);
}
fmsSetPage($found_records_find,'found_records',20); 
$found_records_result = $found_records_find->execute(); 
if(FileMaker::isError($found_records_result)) fmsTrapError($found_records_result,"error.php"); 
fmsSetLastPage($found_records_result,'found_records',20); 
$found_records_row = current($found_records_result->getRecords());
// FMStudio Pro - do not remove comment, needed for DreamWeaver support ?>
Link to comment
Share on other sites

  • 3 weeks later...

This is fantastic -- thank you -- saved the day.  What I realized I was doing wrong, is I was trying to limit it to "onWeb" from the search page, and what I needed to do was add a bit to my results page.  I added $onWeb = 1; ro my results page and then changed the array to match your ('On Web'=>'=='.$onWeb,) -- all works perfectly now.

 

My search is passed through a URL in the pages that FMstudioPro set up for me,  btw.

 

Thank you again

 

-- Don

Link to comment
Share on other sites

It is worthwhile trying to work out how these things really work - FMStudio is a useful tool but not flexible enough or advanced enough for every situation. And I'm not sure it's really a live product anymore - been a long time since I've seen their dev team post anything...

Link to comment
Share on other sites

This topic is 4022 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.