[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GNUe-dev] explicitfields
From: |
Jason Cater |
Subject: |
Re: [GNUe-dev] explicitfields |
Date: |
Thu, 29 May 2003 01:11:53 -0500 |
Dmitry,
Sorry for the delay in responding.
If I recall correctly, explicitfields was added as a "hack" to get certain
summaries to work in GNUe Reports. I don't think they were meant to do
what you are doing, though they might work with some bugfixes.
I do see what you're trying to do, and I have needed something similar. We
might want to consider adding something like a <customfield> tag to
<datasource>. So, your example would read:
<datasource name="dtsHotList" connection="icsinfo"
table="user_hotcontact, company"
order_by="last_update desc">
<customfield name="contact_info">name||' '||phone</customfield>
</datasource>
I need to think about this some more though.
--
Jason Cater
GNU Enterprise
On Fri, 23 May 2003 09:58:08 +0400 (MSD)
Dmitry Sorokin <address@hidden> wrote:
> Hello all,
>
> Question to someone with knowledge of the gnue common.
>
>
> I am using explicidfields in datasource definition in this way:
>
> <datasource name="dtsHotList" connection="icsinfo"
> table="user_hotcontact, company"
> explicitfields="(name || ' ' || phone) as contact_info"
> order_by="last_update desc">
>
> It does not work with current code as "contact_info" field would be
> referenced twice:
>
> DB005: [Driver:566] SELECT phone,name,contact_info,(name || ' ' ||
> phone) as contact_info,contact_id ...
>
>
> ------------------------------------------------------------
> Error: Error while communicating with datasource.
>
> ERROR: Attribute "contact_info" not found
>
> ------------------------------------------------------------
>
>
> I got it working adding some code to remove duplication:
>
> common/datasources/drivers/DBSIG2/Driver.py
>
>
> class DBSIG_DataObject_Object:
> def __init__(self):
>
> ...
>
> def _buildQuery(self, conditions={}, forDetail=None,
> additionalSQL=""):
> dupfields = []
> for field_def in self._fieldReferences:
> field_name = string.split(field_def, " as ")
> if len(field_name)>1:
> if self._fieldReferences.has_key(field_name[1]):
> dupfields.append(field_name[1])
> for dup in dupfields:
> del self._fieldReferences[dup]
>
> ...
>
>
> The question is: is it the right place to fix the problem or it may be
> done earlier to prevent duplication in self._fieldReferences from the
> beginning?
>
> Thanks in advance,
> dimas
>
>
>
>
>
>
>
>
> _______________________________________________
> Gnue-dev mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gnue-dev
>
--