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

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

Recommended Posts

Posted

On my layout I have a field called ProblemList that is defined as a repeating field with up to 50 repetitions. In php I'm trying to insert a record into the table on this layout but I can't seem to do it if I include setting the ProblemList field with a repetition greater than 0.

All of the "problems" I want to insert into the ProblemList field are stored in an array called $problems. I am looping through them and using the setField command to specify the repetition number. Here's my code:


$counter = 0;

foreach($problems as $problem) {

  $request->setField('ProblemList', $problem[1], $counter);

  $counter += 1;

}
  



On my layout, I have the ProblemList field set to an edit box, and I've hidden it by making the text the same color as the background.



It works if I do the following:




$request->setField('ProblemList', $problem[1], 0)

But then of course it only stores one of them. When the counter is incremented, it stops working. Any ideas on this?

Thank you!

~Joanna

Posted

You need all of the repetitions that you want to write to displayed on the layout.

Also, it sounds like you are using the same layout for client access and API development. This is generally a bad idea that can lead to long page load times. You will be better off building API specific layouts that contain only the fields you wish to access via the API.

I'm also assuming that your $problems array is an array of arrays and you always want to grab the second value.

something like

$problems = array(array("a","one"), array("b","two"), array("c","three"));

where you want to write "one", "two", and "three" to the database.

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