Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hi,

I am a newbie to php. I am having an issue with setLogicalOperator. I have the following scenario in FileMaker. I need to fetch all the records for which cDailySheetRecords =1.

The value of this calculation field is set based on logic,

If( (Upper(Left(Accession; 1)) & Final = "SN" ) or (cExpireFromDailySheet ≥ Get(CurrentDate)); 1; 0) --- (note: & is concatenation operator)

where, cExpireFromDailySheet = VMIS_ReleaseDate + 5. This will fetch the below 20 records in FileMaker. It will fetch the records if any one of the above conditions are true.

--------------------------------------------------------------------------------------------------------------------------------------------

Accession Final VMIS_ReleaseDate cExpireFromDailySheet cDailySheetRecords

S09-0723 N 1

S11-0178 N 1

D11-0302 Y 05/13/2011 05/18/2011 1

S11-0336 Y 05/12/2011 05/17/2011 1

S11-0339 Y 05/13/2011 05/18/2011 1

S11-0340 Y 05/13/2011 05/18/2011 1

S11-0341 Y 05/16/2011 05/21/2011 1

S11-0342 Y 05/16/2011 05/21/2011 1

S11-0343 N 1

S11-0344 Y 05/16/2011 05/21/2011 1

S11-0345 Y 05/16/2011 05/21/2011 1

S11-0346 Y 05/16/2011 05/21/2011 1

S11-0347 Y 05/16/2011 05/21/2011 1

S11-0348 N 1

S11-0349 N 1

S11-0350 N 1

S11-0351 N 1

S11-0352 N 1

S11-0353 N 1

S11-0354 N 1

--------------------------------------------------------------------------------------------------------------------------------------------

I have a old php filemaker interface code written sometime back to do the same for web, but it is fetching only 10 records from above. Those are

--------------------------------------------------------------------------------------------------------------------------------------------

Accession Final VMIS_ReleaseDate cExpireFromDailySheet cDailySheetRecords

S09-0723 N 1

S11-0178 N 1

S11-0343 N 1

S11-0348 N 1

S11-0349 N 1

S11-0350 N 1

S11-0351 N 1

S11-0352 N 1

S11-0353 N 1

S11-0354 N 1

--------------------------------------------------------------------------------------------------------------------------------------------

The old php code is given below:

--------------------------------------------------------------------------------------------------------------------------------------------

<!DOCTYPE HTML PUBLIC "-#W3C#DTD HTML 4.0 Transitional#EN">

<html>

<head>

<link rel="stylesheet" href="default.css" type="text/css" media="all" />

<title>Surgical Pathology DAILY Case Reports</title>

</head>

<body>

<form name="listForm" method="post" action="home.php">

<input type="hidden" name="page">

<?php include ("dbaccess.php"); ?>

<h1 id='maroon'>Surgical Pathology DAILY Case Reports</h1>

<?php

#Create the 'find' command and specify the layout

$findCommand =& $fm->newFindCommand('php');

$findCommand->addFindCriterion('Accession', 'S*');

$findCommand->setLogicalOperator('AND');

$findCommand->addFindCriterion('Final', 'N');

$findCommand->setLogicalOperator('OR');

$today = getdate();

$time = mktime(0, 0, 0, $today['mon'], $today['mday'], $today['year']) - 5*24*60*60;

$findCommand->addFindCriterion('VMIS_ReleaseDate', '>='.date('n/j/Y',$time));

$findCommand->setLogicalOperator('OR');

$findCommand->addFindCriterion('VMIS_ReleaseDate', '');

//$findCommand->addSortRule('RecModificationDate',1,FILEMAKER_SORT_DESCEND);

#Perform the find and store the result

$result = $findCommand->execute();

#Check for an error

if (FileMaker::isError($result)) {

echo $result->getMessage() . "</p>";

exit;

}

$records = $result->getRecords();

$totalCount = $result->getFoundSetCount();

echo "<a href='search.php'>Search Daily List</a>";

echo "<h2 id='maroon'>Total no of records: ".$totalCount."</h2>";

echo "<hr />";

#Retrieve and store the questionnaire_id of the active questionnaire

for ($i = 0; $i < $totalCount; $i++)

{

$record = $records[$i];

echo "<p>";

echo "<span id='title'>Clinician: </span>".$record->getField('Clinician')."&nbsp;&nbsp;&nbsp;&nbsp;";

echo "<span id='title'>Clinic Acc. No: </span>".$record->getField('Clinic')."&nbsp;&nbsp;&nbsp;&nbsp;";

echo "<span id='title'>Owner: </span>".$record->getField('Owner')."<br>";

echo "<span id='title'>Pathologist: </span>".$record->getField('Pathologist')."&nbsp;&nbsp;&nbsp;&nbsp;";

echo "<span id='title'>Pathology Accession: </span>".$record->getField('Accession')."&nbsp;&nbsp;&nbsp;&nbsp;";

echo "<span id='title'>Species: </span>".$record->getField('Species')."<br>";

echo "<span id='title'>Diagnosis: </span>".$record->getField('Preliminary Dx');

echo "</p>";

echo "<hr />";

flush();

}

?>

</form>

</body>

</html>

--------------------------------------------------------------------------------------------------------------------------------------------

I know the issue is coming from "setLogicalOperator" below. If you notice in the FileMaker code, we used "&" concatenation operator to do the same. But not sure how to implement the same logic in php. Since the php is using "AND", it is creating issues.

$findCommand->addFindCriterion('Accession', 'S*');

$findCommand->setLogicalOperator('AND');

$findCommand->addFindCriterion('Final', 'N');

I tried changing the above part as

$findCommand->addFindCriterion('Accession', 'S*');

$findCommand->setLogicalOperator('OR');

$findCommand->addFindCriterion('Final', 'N');

$findCommand->setLogicalOperator('OR');

$findCommand->addFindCriterion('Final', 'Y');

but this will fetch many records, which is not what I wanted. Also, tried other variations and combinations but not successful so far.

I would be glad, if any one can help me on this. Let me know if any other info is required.

Thanks,

Venkat Vallala

Posted (edited)

read up on newCompoundFindCommand; I think that's what you are looking for.

Here are some links to the documentation:

creating a compound find: http://www.fmforums.com/fms_help/api/FileMaker/FM.html#newCompoundFindCommand

compound find methods: http://www.fmforums.com/fms_help/api/FileMaker/FMC_CompoundFind.html

Edited by dansmith65
Posted

read up on newCompoundFindCommand; I think that's what you are looking for.

Here are some links to the documentation:

creating a compound find: http://www.fmforums.com/fms_help/api/FileMaker/FM.html#newCompoundFindCommand

compound find methods: http://www.fmforums.com/fms_help/api/FileMaker/FMC_CompoundFind.html

Thanks !!

I will look into it.

This topic is 4929 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.