Abacus in Dynamic Get #507
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#507
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Steps to reproduce the issue
Do some calculations in Abacus (getcustom) and store values in variables according the naming convention.
Expected result
Numbers should be added to the $data array otherwise the results are lost
Actual result
Nothing happens with the results in the variables.
Code generated by JCB:
System information (as much as possible)
Additional comments
Code I have inserted into the abacus code field:
// Here I have to start my calculations
$query->select('count(*) as counter, sum(id) as summe');
$db->setQuery($query);
$temp=$db->loadObject();
$cal_xxxxxxx = $temp->counter;
$cal_xxxxxxy = $temp->summe;
The query object is not available in the Abacus area. Can you give us a screenshot of the method code being generated in the model? Since I suspect this code is probably giving errors.
Hi Llewellyn,
I have put in the code of Generator up in the issue. The $query object is available as I use the Abacus in the "getcustom" custom get. My code works if I put my calculations into the $data object. The JCB code is written in the custom get function,
Manfred
Full code here:
What values do you get in the
$temp
variable if you do avar_dump($temp)
after the database call? You do realize if there is no values in the database it will never get to your code right? Since data will be empty and return false.Wow, I think you are right, this area has changed and the
$cal__xxxxxx
convention is gone. I am not sure where and when this happened. But a closer look just confirmed that this feature is broken, or missing.But hey being able to move the values into the object should be okay right?
I may just need to update that field description, or add the convention back in the compiler. I just search in all the relevant areas and I can't find it anymore. I mean the implementation of this
$cal__xxxxxx
convention.It is obviously not being used since you are the first to pickup it is missing.
The whole purpose of the Abacus area was to work in the loop of the items (if you have items)... but this seems to have been broken. I just checked the compiler and you will see it is added in these places:
The field is dynamically update here:
Both of these areas where massively improved, and refactored last year so I suppose somewhere that convention was lost and miss placed. I will look back at older versions of JCB to see how it worked and if it is worth adding it back, or just do a whole new thing... since it clearly is not working as expected anyway. Oops, my mistake! many things moving around, and since I do not use this area myself... I did not notice the break.
Hi Llewellyn,
my code is working but I was missing the integration. Good to hear that you found a bug.
To have such a "abacus code field" is not necessary as you could also add some code to the PHP section "after getting items", which might be usable for calculations as mine.
If you have some time to add some functionality, it would be great if one could use SQL aggregate functions in the standard views (e.g. count(*) as counter etc.). At this point it is only possible by a custom "custom get" or by tweaking the items after getting the items ;-)
Did you have noticed my post in the Google group regarding the missing filters ("categories" e.g.)? This would also be a nice addition.
Regards
Manfred
I actually do not have time, I can hardly believe that JCB exist... since I build it while not having time... with the purpose of saving time. lol
I am at the moment working on adding an Assistant to JCB to target the 80% of the Joomla world that is not yet programmers, but want to use JCB to build simple components with list, view, and edit for the front-end (site-views). You will see the staging branch already has parts of the GUI in it. Since I have been getting many requests to improve the front-end part of JCB. Which I am reluctant to do... (since i like the freedom it has) but with this Assistant I think we will solve many issues all in one.
You can be sure to have the highest respect of the active community!