Problem adding aggregate datacolumn to datatable

  • Thread starter Thread starter Trygve Lorentzen
  • Start date Start date
T

Trygve Lorentzen

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
 
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");
 
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)"

Cheers,
Trygve

Gozirra said:
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 said:
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
 
Hi,

Trygve Lorentzen said:
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 said:
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 said:
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
 
Back
Top