Page 2 of 2

Re: update and read values from browse subform, from checkbo

Posted: Mon Feb 04, 2019 3:12 am
by kev1n
I guess you can't get around having a client ID.

https://github.com/PHPMailer/PHPMailer/ ... th-XOAUTH2

Re: update and read values from browse subform, from checkbo

Posted: Mon Feb 04, 2019 5:46 am
by rfeltham
(The email admin says the setting is set on the google my account pages. So I need to find a way to php email with OAuth. Sigh.)

An additional issue that I have is that my iFrame has parent_name, child_name, and email_1 as form columns.
When a search is completed, and no text has been put in the iframe's Search box, there is a default search appended to my query:
(from nuDebug)

Code: Select all

    [personbrowseiframeSQLML] => SELECT submission_id,child_name,parent_name,email_1
 from patient_v
  WHERE (child_name LIKE \"%%\") AND   (parent_name LIKE \"%%\")  AND   ( (\"\" IS NOT NULL)
...
AND ( (CONVERT(child_name USING utf8) NOT LIKE  \"%1%\" AND CONVERT(parent_name USING utf8) NOT LIKE  \"%1%\" AND CONVERT(email_1 USING utf8) NOT LIKE  \"%1%\") ) 
The last line nuBuilder added to my search.
If I put in a search term in the search field in the bar in the iFrame (such as "Z"), I get this appended instead:

Code: Select all

 AND  (CONVERT(child_name USING utf8) LIKE  \"%Z%\" OR CONVERT(parent_name USING utf8) LIKE  \"%Z%\" OR CONVERT(email_1 USING utf8) LIKE  \"%Z%\") )
So, LIKE "%Text%" if the search field is set, and NOT LIKE "%1%" if the search field is not set.


Is there a way to change this behavior?

It is eliminating records with emails that have a '1' in them (31 active patients :-( )

Richard F.

Re: update and read values from browse subform, from checkbo

Posted: Tue Feb 05, 2019 8:53 am
by rfeltham
The iFrame was designed with a Browse SQL code that starts with SELECT * FROM...
When the SQL code is grabbed from the iFrame with the
var sql =$("#patient_browse_iframe")[0].contentWindow.nuCurrentProperties().browse_sql
code, not only is the
parent_name NOT LIKE "%1%" AND child name NOT LIKE "%1%" and email_1 NOT LIKE "%1%"
appended, the SELECT is changed to
SELECT parent_name, child_name, email_1 FROM...
I was thinking if I removed the email field, then the odd NOT LIKE "%1%" thing would not affect things. But the result is that I don't get the email field at all, since it does not get selected.

Would it be easier to use nuRunQuery(<SQL Code>); rather than try to sort out the odd NOT LIKE "%1%" thing?
Would I need to use nuProcedure the convert the SQL code with has tags into SQL code with values?

There has to be a way forward, somehow.

Richard F.

Re: update and read values from browse subform, from checkbo

Posted: Tue Feb 05, 2019 10:17 am
by kev1n
You could copy your used browse SQL into a PHP procedure and execute it there. The hash cookies should also be automatically replaced by values.

Code: Select all

$sql = "
SELECT * from persons
WHERE (('#q_child#' IS NOT NULL) AND (child_name LIKE '%#q_child#%'))
AND  (('#q_parent#' IS NOT NULL) AND (parent_name LIKE '%#q_parent#%'))
AND  ( ('#q_condition#' IS NOT NULL)
         AND (    (condition_1 LIKE '%#q_condition#%')
               OR (condition_2 LIKE '%#q_condition#%') ) )
/* This selected for  people who had appointments on multiple days
AND  ( wed = 1 OR ( '#q_wed#' = 0  AND wed = 0 ) )
AND  ( thurs = 1 OR ( '#q_thurs#' = 0  AND thurs = 0 ) )
AND  ( fri = 1 OR ( '#q_fri#' = 0  AND fri = 0 ) ) 
*/
AND (  ('#q_wed#' = 0 AND '#q_thurs#' = 0 AND '#q_fri#' = 0)
     OR  ('#q_wed#' = 1 AND wed = 1)
     OR ('#q_thurs#' = 1 AND thurs = 1)
     OR ('#q_fri#' = 1 AND fri = 1)
     )
AND ( ('#q_clinic#' = 0 AND '#q_grtherapy#' = 0 AND '#q_otherclinic#' = 0 )
     OR ('#q_clinic#' = 1 AND pr_clinic = 1)
     OR ('#q_grtherapy#' = 1 AND pr_grtherapy = 1)
     OR ('#q_otherclinic#' = 1 AND pr_otherclinic = 1)
     )
";

var $q = nuRunQuery($sql);