Jump to content
Server Maintenance This Week. ×

List Dropdown content


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

Recommended Posts

  • 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

Link to comment
Share on other sites

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;
?>

 

Link to comment
Share on other sites

  • 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 

Link to comment
Share on other sites

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