Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

  • Newbies

Hello,

I'm new to developing with FileMaker API, but I have been able to do some stuff with it. But now I reached a wall, and I would appreciate any help.

I'm trying to use the following code to list the content of a Value List, but I'm not seeing how to do it. (You can also see the attached file).

<?php

    //Includes the file with connection details
	include('lib/ligar_filemaker.php');

    //First attempt to list all the data
	$findCommand = $fm->newFindAnyCommand('WEB2_Login');
	$result = $findCommand->execute();
	$records = $result->getRecords();

	foreach ($records as $record) {
		echo $record->getField('Tecnico');
	}
	//Shows random data, instead of a list

    //Second Attempt to list all the data
	$listar = $fm->getLayout('WEB2_Login');
	$listas = $listar->listValueLists();

	print_r($listas);

	$layout_obj = $fm->getLayout('WEB2_Login');
	$value_list = $layout_obj->getValueListTwoFields('Tecnicos');
	foreach ($value_list as $key => $val) {
		echo $val;
	}
	//Doesn't output anything, tried to follow the FileMaker documentation, a bit rubbish on this matter.

?>

 

I added a few comments on the code, and I would appreciate any help on this situation.

- Henry 

index.php

Dear Henry,

That first request will get random records from the database ( FindAny does as it says...)

Also note that FileMaker requires an object to be on the specified layout for anything to be returned - so make sure you have your value list on the Web2_Login layout in FileMaker.

The last one looks like it should work - slightly reworked version below

<?php
    $layout =& $fm->getLayout('Web2_Login');
    $values = $layout->getValueListTwoFields('Tecnicos');
    $valueList = '<select name="TecnicosSelect">';
    foreach($values as $value) {
        $valueList .= '<option value="' . $value . '">' . $value . '</option>';
    }
    $valueList .= '<select>';
    echo $valueList;
?>

 

  • Author
  • Newbies

Dear Henry,

That first request will get random records from the database ( FindAny does as it says...)

Also note that FileMaker requires an object to be on the specified layout for anything to be returned - so make sure you have your value list on the Web2_Login layout in FileMaker.

The last one looks like it should work - slightly reworked version below

<?php
    $layout =& $fm->getLayout('Web2_Login');
    $values = $layout->getValueListTwoFields('Tecnicos');
    $valueList = '<select name="TecnicosSelect">';
    foreach($values as $value) {
        $valueList .= '<option value="' . $value . '">' . $value . '</option>';
    }
    $valueList .= '<select>';
    echo $valueList;
?>

 

Hmmm, I tried right now and it still is giving me an empty output.

But when I put the results in the "Use custom Values", it shows all the data that I put there. But when I use the "Use Values from field", it is sending an empty result.

It is really strange, any other solution that you might have?

- Henry 

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.