danielbidala VIP
Total posts: 153
03 Sep 2014 20:54

I use this SQL ACTIN to update a date field in the record by changing status:

UPDATE #__js_res_record_values SET field_value="2011-09-11 00:00:00" WHERE record_id=[RECORD_ID] AND field_id=77

But take no effect. What is the right syntax?

Last Modified: 20 Oct 2014


Sergey
Total posts: 13,748
04 Sep 2014 00:40

What date you want to update? Article create date or expire date? Or value of the other field?


danielbidala VIP
Total posts: 153
04 Sep 2014 06:17

Hi sergey. I want to update other (custom) date field value!


Sergey
Total posts: 13,748
04 Sep 2014 23:54

FOr field value, this is not only place to alter. This place is used only for search and filter. For display fields column is used. I would try to run comething like this.

UPDATE #__js_res_record 
   SET fields = REPLACE(
        (SELECT v.field_value 
           FROM #__js_res_record_values AS v
          WHERE v.record_id = [RECORD_ID] 
            AND v.field_id = 77), 
        '2011-09-11 00:00:00', fields) 
 WHERE id = [RECORD_ID];

 UPDATE #__js_res_record_values 
    SET field_value="2011-09-11 00:00:00" 
  WHERE record_id = [RECORD_ID] 
    AND field_id = 77;

Something like this should work.Did not tested it as an idea only.


danielbidala VIP
Total posts: 153
18 Sep 2014 19:08

Maestro!

This gives me status of 500 (internal server error) on the console when I change status. And also delete record values when change status.

Any idea?


Sergey
Total posts: 13,748
19 Sep 2014 01:09

When you change status look into console network tab and see result of AJAX (XHR) request. Error have to be there. As I have said I have not tested it. It is only an idea. Try to run this query with AceSQL or PphMyAdmin.


danielbidala VIP
Total posts: 153
19 Sep 2014 08:31

Network tab says: No request captured


Sergey
Total posts: 13,748
21 Sep 2014 04:07

Did you try to run this query in aceSQL?

Do you have any errors in console?


danielbidala VIP
Total posts: 153
21 Sep 2014 12:32

I tried with phpMyAdmin. The query runs but reset all fields to empty. This date field is empty when change status maybe this cause the problem!?


Sergey
Total posts: 13,748
22 Sep 2014 01:58

Did you change [RECORD_ID] to ID of the record?


danielbidala VIP
Total posts: 153
22 Sep 2014 13:10

Yes, of course. I changed it.


Sergey
Total posts: 13,748
23 Sep 2014 02:37

I found one error in REPLACE. fields have to be first parameter. I tested also localy it is working.

REPLACE(fields, (SELECT v.field_value 
       FROM #__js_res_record_values AS v
      WHERE v.record_id = [RECORD_ID] 
        AND v.field_id = 77), 
    '2011-09-11 00:00:00')

danielbidala VIP
Total posts: 153
16 Oct 2014 18:06

Ok, now the value is updated in database but I get this error message (see below) on list view. The status doesn't change only after page refresh.

Untitled-1


Konstantin
Total posts: 1,113
17 Oct 2014 06:53

Can you click on console tab and than on ajax link and you can see what server answer, maybe you must turn display errors on.


danielbidala VIP
Total posts: 153
17 Oct 2014 09:24

Hi Konstantin!

Do you think this ajax link: http://ugyvitel.kalilab.hu/index.php?option=com_cobalt& ;task=ajax.field_call&tmpl=component

If I click on this I get this:

0 - SQL =

This site is not searchable 'for the following reasons:

Date bookmark / favorite The search engine obsolete data from this site mistyped URL You do not have permission to access this page The requested resource was not found. The error occurred while processing your request. Please try one of the following sites:

Home Page If difficulties persist, please contact your site administrator and report the following error ..

SQL =

Where to turn on display errors?


Konstantin
Total posts: 1,113
17 Oct 2014 09:49

danielbidala http://ugyvitel.kalilab.hu/index.php?option=com_cobalt& ;task=ajax.field_call&tmpl=component

Yes, this is ajax url.

danielbidala 0 - SQL =

This mena that you have some errors in sql query, check it.


Sergey
Total posts: 13,748
20 Oct 2014 08:46

danielbidala Where to turn on display errors?

In global Joomla configuration. Turn on debug mode and Error reporting.

Powered by Cobalt