<div dir="ltr"><div>You can go to the Module settings and under Relationship tabs to add or remove relationships, but in case you don't find the module that you are looking for, you can also do it programmatically. </div><div><br></div><div>You can add related modules by running a php script. replacing the values for 'PrimaryModule' and 'RelatedModule' on the script below. In this example we are creating a relationship between the primary module Leads to Documents module. Organizations I think the Accounts module and then the Contacts will be the related module for the script below.</div><div><br></div><div><php?</div><div><br></div><div>$PrimaryModule = 'Leads'<br></div><div>$RelatedModule = 'Documents'</div><div><br></div><div>include_once('vtlib/Vtiger/Module.php');<br>$moduleInstance = Vtiger_Module::getInstance($PrimaryModule);</div><div><br>//Module Relationship<br>$relatedModule = Vtiger_Module::getInstance($RelatedModule);</div><div> $relationLabel = $RelatedModule;<br> $moduleInstance->setRelatedList($relatedModule, $relationLabel, Array('ADD','SELECT')); <br> echo "Relationship Created\n";<br><br></div><div>?><br></div><div><br></div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><p class="MsoNormal">Best Regards,</p><p class="MsoNormal"><br></p><p class="MsoNormal"><b><i>Orville </i></b></p>
<p class="MsoNormal"> </p></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 5, 2023 at 1:55 PM Steve Kenow <<a href="mailto:skenow@rdspos.com">skenow@rdspos.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Except that's not an option - at least in the base version. Can only select Tickets, Comments, and Documents.<br></div><div><br></div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><i><b>Steve Kenow</b></i><br></div><div>Retail Data Systems of Minnesota<br></div><span>End-User Services & Support Manager</span><br><div>Direct: (952) 392-2686</div><div>Office: (952) 934-4002</div><div><a href="mailto:skenow@rdspos.com" target="_blank">skenow@rdspos.com</a></div><div><br><img src="http://rdspos.com/Portals/0/Web-RDS-Logo.jpg" width="96" height="39"><br><br>Support Questions/Issues? Email <a href="mailto:rdshelp@rdspos.com" target="_blank">rdshelp@rdspos.com</a> (non-emergencies) or call (952) 934-4002 24/7</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 5, 2023 at 3:51 PM Steve Kenow <<a href="mailto:skenow@rdspos.com" target="_blank">skenow@rdspos.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Contacts is the primary module and Organizations is set as a related module. Is that how I'll need to adjust?<br></div><div><br></div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><i><b>Steve Kenow</b></i><br></div><div>Retail Data Systems of Minnesota<br></div><span>End-User Services & Support Manager</span><br><div>Direct: (952) 392-2686</div><div>Office: (952) 934-4002</div><div><a href="mailto:skenow@rdspos.com" target="_blank">skenow@rdspos.com</a></div><div><br><img src="http://rdspos.com/Portals/0/Web-RDS-Logo.jpg" width="96" height="39"><br><br>Support Questions/Issues? Email <a href="mailto:rdshelp@rdspos.com" target="_blank">rdshelp@rdspos.com</a> (non-emergencies) or call (952) 934-4002 24/7</div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 5, 2023 at 11:14 AM Alan Lord <<a href="mailto:alanslists@gmail.com" target="_blank">alanslists@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 05/06/2023 16:38, Steve Kenow wrote:<br>
> I would think it's a left join, and the 'is empty' would return <br>
> non-matching records in the related tables (equivalent to is null)<br>
<br>
Yeah, but the report engine doesn't quite work that way. Take a look at <br>
the file ReportRun.php (then run away!!!)<br>
<br>
> This gives me one of the datasets I look at (the report in VT6.5 works <br>
> as desired) -<br>
> select * from vtiger_account a<br>
> left join vtiger_servicecontracts s on a.accountid = s.sc_related_to<br>
> join vtiger_accountscf c using (accountid)<br>
> where c.cf_807 = 'Active'<br>
> and s.servicecontractsid is null;<br>
<br>
If only it were that simple... It can be actually. We have an extension <br>
that lets admin users write their own SQL Report queries.<br>
<br>
<a href="https://libertus.co.uk/sql-reports/" rel="noreferrer" target="_blank">https://libertus.co.uk/sql-reports/</a><br>
<br>
> Here's another twist - some modules work! I look for Contacts without <br>
> Organizations, the list is correct in both 6.5 and 7.5<br>
<br>
With the Organisation as the Primary module again?<br>
<br>
Al<br>
<br>
_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div>
</blockquote></div>
_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a></blockquote></div>