Newbies Wolfgang Pachur Posted September 12, 2015 Newbies Posted September 12, 2015 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
webko Posted September 14, 2015 Posted September 14, 2015 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...
Newbies Wolfgang Pachur Posted September 14, 2015 Author Newbies Posted September 14, 2015 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
Newbies Wolfgang Pachur Posted September 15, 2015 Author Newbies Posted September 15, 2015 OK solved: I had to include the execute() and getrecord() calls and the foreach(record) into the loop as well. Wolfgang 1
Recommended Posts
This topic is 3652 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 accountSign in
Already have an account? Sign in here.
Sign In Now