September 12, 201510 yr Newbies Hello, I want to have a script pause when a field is not empty, and to continue as it is not empty any more. So I tried this infinite loop: while (1 == 1){ echo "Test if field is empty..." . "<br>"; $val_block = $record->getField("web_block_n"); if ($val_block == "") {break;} echo "wait for field is not empty..." . "<br>"; sleep(5); } Result: When field "web_block_n" has already been empty, the loop breaks immediately as expected. But if the field is not empty before the php script starts, and I make it empty after start, nothing happens. The browser from where the script was called, is just in wait mode, and no echo output at all is shown. What is wrong? Thank You Wolfgang
September 14, 201510 yr Well, it would - where is the web submit to actually make the field in the database change? The web is not like FM - you need to actively make a change, and then that value will persist in the web browser until another call is made...
September 14, 201510 yr Author Newbies I change (and save) the field by hand, directly, in the FM layout, while the script is running. The complete code is like this: $theCommand = $fm->newCompoundFindCommand($layoutName); $request = $fm->newFindRequest($layoutName); $request->addFindCriterion('web_identifier_x', "identifier_a"); $theCommand->add(1, $request); $resultfm = $theCommand->execute(); $records = $resultfm->getRecords(); foreach ($records as $record) { ... while(1) { $val_block = $record->getField("web_block_n"); if ($val_block == "") {break;} sleep(3); } ... } I there something I miss? Do I have to repeat i.e. getrecords(), or execute() as well inside of the loop ? Wolfgang
September 15, 201510 yr Author Newbies OK solved: I had to include the execute() and getrecord() calls and the foreach(record) into the loop as well. Wolfgang
Create an account or sign in to comment