Problems with the Where Condition

How to fix date range queries in ChronoForms v6 that return incomplete results.

Overview

The issue occurs when using incorrect date formats in the WHERE condition, causing the query to omit valid records.
Ensure all date values use the correct YYYY-MM-DD format, such as changing '2016-10-1' to '2016-10-01', to allow proper filtering between specified dates.

Answered
Connectivity v6
ma maggie77 01 Mar, 2017
Hello,

I have a where condition like this:

<?php
$user = \JFactory::getuser();
return array('Ehepaar.berater' => $user->id);
?>

And I get this error:
1054 Unknown column 'Ehepaare.693' in 'where clause' SQL=SELECT COUNT(`Ehepaare`.`id`) AS `Ehepaare.count` FROM `#__chronoengine_chronoforms_datatable_ehepaar-anlegen` AS `Ehepaare` WHERE `Ehepaare`.`693` = '';

Where did I go wrong?
Thanks for your help
Max_admin Max_admin 01 Mar, 2017
Answer
Hi Maggie,

For v6 you can use this:
Ehepaar.berater:{user:id}


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
at atanunu 01 Mar, 2017
Sir, How can I use this CCv5 code for CCv6; all my attempts had failed

return array( ": `PWVPaymentStatus` = '{$form->data['pcstatus']}' AND ( `PWVTransactionDate` BETWEEN '{$form->data['pcfromactual']}' AND '{$form->data['pctoactual']}' )" );
Max_admin Max_admin 02 Mar, 2017
Hi atanunu,


Model.PWVPaymentStatus:{data:pcstatus}
Model.PWVTransactionDate/>=:{data:pcfromactual}
Model.PWVTransactionDate/<=:{data:pctoactual}


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
at atanunu 02 Mar, 2017
Thanks Sir,

I tried it does not give me the actual results as expected; I have attached a screenshot of the debug action

[attachment=73180_20170302064521_screenshot-www-probun-com-2017-03-02-07-42-12-png.png][/attachment]
Max_admin Max_admin 03 Mar, 2017
Hi atanunu,

What is the problem with the results ? what about the "PWVTransactionDate" field, is it DATE or DATETIME ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
at atanunu 04 Mar, 2017
Sir,

I have corrected the date time aspect; but I am not getting the expected results;this is CCv6 http://bit.ly/2lGgY5f and this is CCv5 http://bit.ly/2mPCGWg

Both links are expected to work in the same way.

Thanks Sir
Max_admin Max_admin 04 Mar, 2017
Hi atanunu,

Lets focus on v6, what about the data in your table, do you have more records between the 2 dates provided ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
at atanunu 04 Mar, 2017
Sir,

Sorry I meant CF v5; Some records don't appear, and for some day range no records appear - I am sure that there are records for these dates and I also know the number of records to display on query.
Max_admin Max_admin 04 Mar, 2017
Hi atanunu,

Please try the "Between" query and the query generated using v6 on phpmyadmin, do they give the same results or not ? when trying the "between", just replace the where part with the "between" section and check the results.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
at atanunu 07 Mar, 2017
1 Likes
Sir,

The issue seem resolved; the problem was with the date I used; The first code below gave results with some records omitted while the second gave me the records as expected.

Thanks for your support.

[PCfromactual] => 2016-10-1 00:00:00 AM
    [PCtoactual] => 2017-03-08 00:00:00 AM



[PCfromactual] => 2016-10-01 00:00:00 AM
    [PCtoactual] => 2017-03-08 00:00:00 AM
Max_admin Max_admin 07 Mar, 2017
1 Likes
Hi atanunu,

Yes, the format must be correct for this to work!

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.