Proper syntax for 'Single yes where' for Yes/No element?

chris.paschen

Chris Paschen
I've tried to figure out exactly how to use the 'Single yes where' but can't figure it out.

The tip says:
table.field = '{table___field_raw}'

Specific use-case:

I have master (one) table of: ked_books_books
With a primary field of: id

I have a child(many) repeating table of: ked_books_books_39_repeat
With a field that connects the two tables of: parent_id

I would like to use the 'single yes where' to force that just 1 entry in the ked_books_books_39_repeat with the ID matching the current ked_books_books___id has a 'yes' value (i.e. only 1 'yes' per book).

I've tried all of the following syntax, but nothing seems to do what I am trying to achieve:

  • ked_books_books_39_repeat.parent_id = '{ked_books_books___id_raw}'
  • '{ked_books_books_39_repeat___parent_id_raw}' = '{ked_books_books___id_raw}';
What should be the proper syntax here?
 
Your first attempt:

ked_books_books_39_repeat.parent_id = '{ked_books_books___id_raw}'

... should do it. I tested it here, and it does what it's supposed to do. The query the yesno element generates is:

UPDATE ked_books_books_39_repeat
SET active = 0
WHERE ked_books_books_39_repeat.id <> 5 AND ked_books_books_39_repeat.parent_id = '35'

... which does exactly what it's supposed to do.

-- hugh
 
Well, of course it does IF you aren't manually doing an end-run around the code (like I was).

[I think I'm ready for the weekend :-( ... my code sure is! :-o ]
 
BTW, there's a bunch of warnings coming out of your various functions in the PHP files. If you stick an 'exit' in somewhere at the end of processing, you'll see them.

Again ... I thoroughly recommend investing $100 in PHP Storm. It'll save you that much in wasted time and frustration in the first week of doing any PHP coding. And I'd be quite happy to help you get set up and through the learning curve.

-- hugh
 
FYI ... just downloaded PHP Storm ... can't wait to get at those warnings and clean them up.
If you have recommendations on tutorials/etc for getting PHP Storm set-up please forward them.
(I've used Eclipse in the past so I'm familiar with this 'type' of tool, and I think that I had a trial of PHPStorm several years ago, but this looks quite different.)
Rolling up my sleeves now! :)
Thanks
 
Is xdebug installed in WAMP?

Best way to start with a local project is File -> New project from existing files, and let it guide you through setting it up.

-- hugh
 
I haven't instaled xdebug; although I do see options for that in WAMP.

Yup... File->New project is how I started each out.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top