I have the following code to create an array for graphing. It lives in the before edit of the form
$a[] = ['Reason', 'Referrals'];
$sd="#start_date#";
$ed="#end_date#";
$s = "
SELECT
referral_reasons.reasonforreferral AS reason,
COUNT(referral.referralreasonsID) AS Referrals
FROM
referral
LEFT JOIN referral_reasons ON referral.referralreasonsID=referral_reasons.id
WHERE
(referral.referralDate BETWEEN '$sd' AND '$ed')
GROUP BY referral.referralreasonsID
";
$t = nuRunQuery($s);
while($r = db_fetch_row($t)){
$a[] = [$r[0], Floatval($r[1])];
}
$j = "gdata = " . json_encode($a) . ";";
nuAddJavascript($j);
I need to display the dates ( $sd $ed) as part of the graph. Can I build them into the array? Are they available within an HTLM object on the form?
Now sorted - the dates are available within the js script of the HTML object.
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Inlude select dates in json array
-
- Posts: 114
- Joined: Sun Sep 29, 2019 12:40 pm
Inlude select dates in json array
Last edited by GlenMcCabe on Wed Apr 21, 2021 2:36 pm, edited 1 time in total.
-
- Posts: 114
- Joined: Sun Sep 29, 2019 12:40 pm