wvantongeren Posted March 4, 2019 Report Share Posted March 4, 2019 Hi all, Whats wrong with this code? SELECT sum(Teller) FROM K_Schadekenmerken_Data WHERE OfferteNR = target.[@field:OfferteNR] Greatings from the Netherlands Quote Link to comment Share on other sites More sharing options...
0 TsiBiRu Posted March 4, 2019 Report Share Posted March 4, 2019 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 Quote Link to comment Share on other sites More sharing options...
0 Glitch Posted March 4, 2019 Report Share Posted March 4, 2019 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. Quote Link to comment Share on other sites More sharing options...
0 BaySunshine Posted March 4, 2019 Report Share Posted March 4, 2019 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. Quote Link to comment Share on other sites More sharing options...
0 wvantongeren Posted March 5, 2019 Author Report Share Posted March 5, 2019 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 Quote Link to comment Share on other sites More sharing options...
0 Glitch Posted March 5, 2019 Report Share Posted March 5, 2019 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". Quote Link to comment Share on other sites More sharing options...
0 wvantongeren Posted March 14, 2019 Author Report Share Posted March 14, 2019 Hi Vanallope, I solved my problem I was counting with text instead of numbers, stupid. Don't try to smile Quote Link to comment Share on other sites More sharing options...
0 Glitch Posted March 16, 2019 Report Share Posted March 16, 2019 I sometimes do the same mistake Glad that you made it work! You're awesome! Quote Link to comment Share on other sites More sharing options...
0 MayMusic Posted March 19, 2019 Report Share Posted March 19, 2019 Is Teller a Number field or a text field? It has to be a number type in your table. Is " K_Schadekenmerken_Data " a table or a view? If it is a view you need to add "_v_" in front of the name for instance: _v_ K_Schadekenmerken_Data Quote Link to comment Share on other sites More sharing options...
Question
wvantongeren
Hi all,
Whats wrong with this code?
SELECT sum(Teller) FROM K_Schadekenmerken_Data WHERE OfferteNR = target.[@field:OfferteNR]
Greatings from the Netherlands
Link to comment
Share on other sites
8 answers to this question
Recommended Posts
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.