Jump to content
  • 0

Select sum


wvantongeren

Question

8 answers to this question

Recommended Posts

  • 0

Hi @wvantongeren,

Your formula seems to be correct, what error message are you getting?
If your 'K_Schadekenmerken_Data '  source is a view and not a table, kindly use the code below instead.

SELECT sum(Teller) FROM _v_K_Schadekenmerken_Data WHERE OfferteNR = target.[@field:OfferteNR]

And if your 'K_Schadekenmerken_Data' source is a table, kindly provide us a screenshot of the table structure/design of this table so that we can further assist you with this,

Regards,

TsiBiRu

Link to comment
Share on other sites

  • 0

I have the same formula in my DataPage.

SELECT SUM (Price) FROM Additional_Resources WHERE Additional_ID= target.[@field:Additional_ID]

You need to make sure if the "Teller" is on Number or Integer or even Currency DataType, and make sure that you are selecting the correct Column Name and Table name as well. 

Hope this helps. :P:P

Link to comment
Share on other sites

  • 0

Hi @wvantongeren,

Also make sure to add a group by clause if there are multiple records containing the same ID. Is OffertNR an ID field? If it is then try the following:

SELECT sum(Teller) FROM K_Schadekenmerken_Data WHERE OfferteNR = target.[@field:OfferteNR] group by OfferteNR

For examples, check out https://www.w3schools.com/sql/sql_groupby.asp.

Link to comment
Share on other sites

  • 0
Hi,
Nothing works!
Previously, I applied this to other DataPages:
SELECT (Artikelprijs) FROM Betontechniek_Bonnen_Producten  WHERE Artikelnummer = 4000
And
SELECT SUM (Werk_uren) FROM Beton_Bonnen_Daguren_1 WHERE Werknummer = target.[@field:Klus_Werknr]

It's still working.

 

If I change the last code (I want to count how much rows ther are with the same OfferteNR) in:

SELECT SUM (Teller) FROM K_Schadekenmerken_Data  WHERE OfferteNR = target.[@field:OfferteNR]

 

it does not work, see a piece of my table and error message.

Table.pdf

Error.jpg

Error2.jpg.35e95dc1f3094b6d72f5d81810b765d6.jpgError2.jpg.35e95dc1f3094b6d72f5d81810b765d6.jpg

Error2.jpg

Link to comment
Share on other sites

  • 0

Hi there!

I noticed the error there saying "Invalid column name 'OfferteNR'".

I just want to verify, do you have a field "[@field:OfferteNR]" inside the DataSource?

As the error says, it has something to do with the Column Name. 

I also noticed that you are using a View. You should atleast have the field OfferteNR in it. 

I know this sounds like a crazy assumption but I tried replicating the error on my end, and the error occurs when I don't have the field on my DataSource, since I have no field to compare it to. 

 

Please check out the formula I tried:

http://prntscr.com/mtrjuf

http://prntscr.com/mtrkdi

If this is not the case, can you please specify what are the DataTypes of the field you are selecting? "Teller" and "OfferteNR".

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...