update and read values from browse subform, from checkboxes

Questions related to customising nuBuilder Forte with Javascript or PHP.

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

Postby kev1n » Mon Feb 04, 2019 11:42 am

I guess you can't get around having a client ID.

https://github.com/PHPMailer/PHPMailer/ ... th-XOAUTH2
kev1n
 
Posts: 203
Joined: Mon Oct 15, 2018 2:13 am

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

Postby rfeltham » Mon Feb 04, 2019 2:16 pm

(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.
Attachments
Screen Shot 2019-02-03 at 8.38.46 PM.png
Search field on iFrame
Screen Shot 2019-02-03 at 8.38.46 PM.png (103.4 KiB) Viewed 243 times
rfeltham
 
Posts: 11
Joined: Mon Jan 14, 2019 5:41 am

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

Postby rfeltham » Tue Feb 05, 2019 5:23 pm

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.
rfeltham
 
Posts: 11
Joined: Mon Jan 14, 2019 5:41 am

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

Postby kev1n » Tue Feb 05, 2019 6:47 pm

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);
kev1n
 
Posts: 203
Joined: Mon Oct 15, 2018 2:13 am

Previous

Return to Custom Code