[FX.php List] Comparing Value from Portal Field to Field Value
DC
dan.cynosure at dbmscan.com
Tue Sep 19 13:51:04 MDT 2006
Hi Kim,
Two ideas:
if you can modify FMP database...
1) make a relationship that keys on the date fields you are trying to
compare, then use that relationship in a new portal and you will
always only have matching records so no PHP matching necessary.
if you want to do it in PHP for some reason...
2) every FX 'data' result returns an array for every field on the
layout. for consistency, even simple, non-related and non-repeating
fields return an array - as you know - with just one value at key 0.
related fields that would show up in a portal in FMP layout with
multiple records return an array (with multiple values if there are
multiple related records) through FX. so in order to deal with them
in PHP matching tasks you have to deal with the entire array either
using in_array() or a comparison in a foreach().
HTH,
dan
On Sep 19, 2006, at 1:51 PM, Kim Hawksworth wrote:
> This one has got me stumped.
>
> I have two related tables. One contains formula records for
> intravenous nutrition and the other contains comments about formula
> changes. There’s the potential to have multiple related records in
> each table, but not necessarily an exact match. In other words,
> there could be 6 records in the formula table and only 2 related
> records in the comments table. What I’m trying to do is compare
> the creation date field from the records in formula table with the
> creation date field from the records in the comments table. If
> they match, display an asterisks on row of the corresponding
> formula in the results page so the user knows there’s a comment
> associated with that record. I can get this to work with the first
> record in the comments table but not any others. Two things I’ve
> tried without success is a second instance on the formula results
> page that queries for related records in the comments table and a
> portal on the layout of formulas table. The portal displays values
> from each related record just fine, but I can’t get it to compare
> more than the first record. Here’s a snippet of the code I’ve
> tried using the portal:
>
> $tpnData_search = new FX($serverIP, $webCompanionPort,
> $dataSourceType);
> $tpnData_search ->SetDBData("nss.fp7", "tpn", $GroupSize);
> $tpnData_search -> AddDBParam("visit_num", "$visit_num");
> $tpnData_search -> AddSortParam("date_rev", "descend");
> $tpnData_search -> AddSortParam("time", "descend");
> $tpnData_search -> FMSkipRecords($skipSize);
> admTpn_results = $tpnData_search -> FMFind();
>
> <tr>
>
> foreach ($admTpn_results['data'] as $key => $returnedData) {
>
> if ($returnedData['date'][0] == $returnedData['tpn_comments::date']
> [0]) {
>
> ?>
> <td align="center"><a style="text-decoration: none;"
> href="javascript:popUpWin2('/nss/tpnComments/
> tpnCommentResultsIndv.php?visit_num=<?php echo $recordData
> ['visit_num'][0]; ?>&date=<?php echo $commentData['date'][0]; ?
> >')"> * </a>
> </td>
> <?php
> } else {
> ?>
> <td> </td>
>
> <?php
> }
> }
> ?>
> </tr>
>
> Any thoughts or suggestions on how to compare more than one record
> will be greatly appreciated.
>
> Thanks for your time.
>
> --Kim
>
> --
> Kim David Hawksworth, R.Ph., Web Manager
> The OSUMC Dept. of Pharmacy
> 410 W. 10Th Ave, Room 368 Doan
> Ph# (614) 293-3765
> Pager# (614) 730-8143
> Email: kim.hawksworth at osumc.edu
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20060919/c99d08dd/attachment.html
More information about the FX.php_List
mailing list