#917 - Sort subpanel records in Generated document - can't make it work
Hi MMR is updated to 2.4 but no success on sorting subpanel records in generated Document Used code from example from opportunities, changed query_table and field_name in SQL statement ORDER BY also changed opportunities into my child module_name kir_deal_items File is placed in custom/main_module_folder wich is kir_kp No success it never goes inside condition if (isset($main_data['kir_deal_items']) && is_array($main_data['kir_deal_items']) && count($main_data['kir_deal_items']) > 1 ) Any suggestions?
10 years ago
Note: this question continues from case https://www.sugaroutfitters.com/support/mail-merge-reports/832. This question also was answered in this case https://www.sugaroutfitters.com/support/mail-merge-reports/468
We assume that the question is coming from this example https://gist.github.com/anonymous/df03390386ba6c89ebe4 . $main_data variable don't exists in the MMR code. To use something like that you need to get that value first. Check it in the example the previous code to use (... foreach ($this->Generate_Document_Instance->datos as $main_key => $main_data) ...)
Check the class name used for the Calculated Fields file, and remember to add require_once('modules/DHA_PlantillasDocumentos/DHA_DocumentTemplatesCalculatedFields_base.php') before declare class name. If needed, debug this problem in function GetCalculatedFieldsClass (in \modules\DHA_PlantillasDocumentos\Generate_Document.php) to get where is the problem. This function is responsible to get the instance of the calculated fields class.
10 years ago
Sure code was used from example in opportunity In previous conversation i wrote names of my modules and pasted code. You confirmed that code is right. But it was not working. I solved the problem by my own and it was: $main_data['kir_deal_items'] - here we should place name of relationship not module name in the array's index so code must be $main_data['kir_deal_items_kir_kp'] (in my case). In core sugarcrm files names of relationship is generally the same as module name, so hard to figure out without documented example's code where to use module_name and where relationship_name. It would be nice to have descriptions in code in english (variables naming also would be greate). Now it works :)
Thanks
9 years ago
Hey KIR, is there any chance you could post your full solution code/placement etc? Thanks for any assistance you can give