Re: Problem adding aggregate datacolumn to datatable by Bart
Bart
Thu Nov 30 14:43:21 CST 2006
Hi,
"Trygve Lorentzen" <trygveloAThaldenDOTnet> wrote in message
news:%234Uu1s7EHHA.4080@TK2MSFTNGP02.phx.gbl...
> The "dsAES_aes-aes_packages" is the name of the relationship. It must be
> specified since the parent table ("aes") has 3 child tables. However I
> tried the example you gave me and it returns the exact same error. There
> must be something weird/special case in my code? The correct statement
> according to the documentation is:
> "Sum(Child(dsAES_aes-aes_packages).F35_GROSSWEIGHT)"
It's reading the hyphen as a minus sign. Try to put the relationname
between square brackets, eg.:
Sum(Child([dsAES_aes-aes_packages]).F35_GROSSWEIGHT)
Also Sum(Child.F35_GROSSWEIGHT) should either work or produce a different
error depending on the number of child relations.
HTH,
Greetings
>
> Cheers,
> Trygve
>
> "Gozirra" <rmturner23@hotmail.com> wrote in message
> news:1164728167.706479.123860@45g2000cws.googlegroups.com...
>> >From what I've seen, Child is not a function. What I am wondering is
>> what is dsAES_aes-aes_packages? Is this a separate dataset?
>>
>> My understanding of expression columns is that child refers to a table
>> that your current table has a reference (foreign key) to. So the
>> tables must be in the same dataset with all appropriate relationships
>> configured. Then you should be able to add your new expression column
>> like so -
>> dsAESWS.Tables["aes"].Columns.Add("F35_GROSSWEIGHT_TOTAL",
>> typeof(decimal), "Sum(Child.F35_GROSSWEIGHT");
>>
>> Trygve Lorentzen wrote:
>>> Hi,
>>>
>>> I've tried with:
>>>
>>> dsAESWS.Tables["aes"].Columns.Add("F35_GROSSWEIGHT_TOTAL",
>>> typeof(decimal),"Sum(Child(dsAES_aes-aes_packages).F35_GROSSWEIGHT)");
>>>
>>> dsAESWS.Tables["aes"].Columns.Add("F35_GROSSWEIGHT_TOTAL",
>>> typeof(decimal),"Sum(Child(dsAES_aes-aes_packages.F35_GROSSWEIGHT))");
>>>
>>>
>>>
>>> Both give me an exception like this:
>>>
>>> syntax error in aggregate argument: Expecting a single column argument
>>> with
>>> possible 'Child' qualifier
>>>
>>>
>>>
>>> I basically copied the statement from the VS help file so I have no idea
>>> what could be wrong here...
>>>
>>>
>>>
>>> I appreciate all help, thanks in advance!
>>>
>>>
>>>
>>> Trygve
>>
>
>