Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Am trying to view data from a portal on a layout. In looking for answers I saw info and examples from FMWebschool, but they seem to prefer using dual-searches, one for parent and another for related data. I have "PHP in 8 hours" but their example again is dual-searches for simple relationship models.

I don't want to tie up server time (many simultaneous connections), plus I have very complex relationships (4-6 AND stipulations for each relationship) already set-up with many portals on the layout all viewing related data from many relationships.

I already have php web pages sowing standard fields but want to view selected portal data (already being displayed on the FMP layout) also without having to add additional searches to the scheme.

Tried the obvious; didn't work:

foreach($searchResult['data'] as $key=>$searchData){

$dateFrom=$searchData['DateFrom'][0];

$gameCount=$searchData['GameCount'][0];

$relatedStuff=$searchData['Relation::Stuff'][0];

}

Looked through FX examples but they are complex and I couldn't seem to find a simple example of related-data display.

Included with FX.php was a "DatasetDiagram" which lead me to try stabbing in the dark to no avail:

$relatedStuff=$searchData['Relation::Stuff'][0][0];

$relatedStuff=$searchData['Relation::Stuff'][0.0];

$relatedStuff=$searchData['Relation::Stuff'][0.1];

$relatedStuff=$searchData[0]['Relation::Stuff'][0];

Posted

Hi LeLand,

You do not have to do any new searches to display your portal data.

You can use a for loop to view the data in question.

Basically, when you have portal data on the layout you get a nested array of data. The array starts at 0 (zero) and increases by 1 for each record. Therefor, using a for loop you simply increment a counter and then use that in place of the repetition number (or closing 0) for each field.

Just make sure that the filed you use as a counter always has data and is in the portal.


for($counter=0; $counter 

HTH

Posted

Thank you for the prompt reply!

I understand what you've said and it certainly confirms my assumptions. My only difficulty now is the details & syntax.

I tried several times and kept getting errors.

Here's some of the actual code that may be helpful:

$search=new FX($serverIP,$webCompanionPort);

$search->SetDBData('GameFile.fp7','Games', 1);

$search->AddDBParam('UserID',$userID);

$searchResult=$search->FMFind();

foreach($searchResult['data'] as $key=>$searchData) {

$dateFrom=$searchData['DateFrom'][0];

}

.

.

.

echo $dateFrom;

So using this code for our example, what would the exact syntax be to extract & display the following related data from the same layout?

AprilGames::Week1Games

AprilGames::Week2Games

MayGames::Week1Games

MayGames::Week2Games

Posted

Hi LeLand

an example eh? ok then. First you gave a few fields, but do not state how the portal data is made up, so I will show how you can use the for loop to create a break seperated list of the data for Week1Games from the April Games portal.

$search=new FX($serverIP,$webCompanionPort);

$search->SetDBData('GameFile.fp7','Games', 1);

$search->AddDBParam('UserID',$userID);

$searchResult=$search-> ;FMFind();



foreach($searchResult['data'] as $key =>$searchData) {

  $dateFrom=$searchData['DateFrom'][0];

}

echo $dateFrom;



for($counter=0; $counter 

HTH

Posted

It worked, it worked, it worked!

I'm as giddie as a school-girl....okay, scratch that, ... maybe a school-boy

Thank you for your help; everything was going so smoothly until this little hiccup came along. Never had to deal with web-site based related data before so it was a little "cloudy".

Now back to work!

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