Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 11 to 20 of 23 total |
DBISAM2: Calculate with SUMs from two tables and different GROUP BYs |
Fri, Jun 6 2014 7:12 AM | Permanent Link |
HeiNi | Delphi 5 Enterprise SP1
Roy Lambert wrote: HeiNi Another question - which version of Delphi are you using? Roy Lambert |
Fri, Jun 6 2014 7:17 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | HeiNi
This component may work - it compiles & installs but I can't test it lacking V2 tables unit DBISAMMultiQuery; interface uses Windows, Messages, SysUtils, Classes, DB, DBISAMTb; type TDBISAMMultiQuery = class(TDBISAMQuery) private { Private declarations } protected { Protected declarations } public { Public declarations } procedure Open; published { Published declarations } end; procedure Register; implementation procedure Register; begin RegisterComponents('DBISAM ', [TDBISAMMultiQuery]); end; {TDBISAMMultiQuery } procedure TDBISAMMultiQuery.Open; var Cntr: integer; sl: TStringList; begin if SQL.Count > 1 then begin sl := TStringList.Create; sl.Assign(SQL); try for Cntr := 0 to sl.Count - 2 do begin Close; SQL.Text := sl[Cntr]; Open; end; CLose; SQL.Text := sl[sl.Count-1]; Open; finally sl.Free; end; end else inherited; end; end. Roy Lambert |
Fri, Jun 6 2014 7:37 AM | Permanent Link |
HeiNi | Hi Roy,
In the test.zip File is a simple set of V2 tables and a simple form for testing, which I used. Thank you for helping me. Heiko Roy Lambert wrote: HeiNi Sorry, I missed that bit I don't have any version 2 tables so I can't play, all I'm doing is guessing and relying on ancient memories. If not to big or confidential you could post the tables and the queries so far to the binaries and I'll be able to actually try things. Attachments: Test.zip |
Fri, Jun 6 2014 9:37 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | HeiNi
OK the component attached should work for you (it did here). Install it in D5 (its written using D6 which is the earliest version I still have but I think it will be OK) Drop your SQL into the SQLScript property, make sure each statement ends with a semicolon, and the last statement is the one you want to have produce the result set. Its almost like a query but you use ExOpen to run it. Roy Lambert Attachments: DBISAMMultiQuery.pas |
Fri, Jun 6 2014 3:44 PM | Permanent Link |
HeiNi | Hi Roy,
Thank you very much that you made the multiSQL for me. I approximative it Greetings Heiko Roy Lambert wrote: HeiNi OK the component attached should work for you (it did here). Install it in D5 (its written using D6 which is the earliest version I still have but I think it will be OK) Drop your SQL into the SQLScript property, make sure each statement ends with a semicolon, and the last statement is the one you want to have produce the result set. Its almost like a query but you use ExOpen to run it. Roy Lambert |
Tue, Jun 10 2014 5:10 AM | Permanent Link |
HeiNi | Hi Roy
before installing the component I had to rename TDBISAMMultiSQL.pas to DBISAMMultiSQL.pas then installing succeede. Calling ExOpen I get the Error "unknown identifier". In fact I can't find a procedure called ExOpen but Open. So I tried Open with the script in SQL. I got the SQL error FROM keyword expected, instead found '''. It's a bit strange to me because I don't have any ' in the script. Also ExecSQL or ExecSQLScript did not work. I created an icon for the component (attached). I never created my own component, so I am a bit helpless. Heiko Roy Lambert wrote: HeiNi OK the component attached should work for you (it did here). Install it in D5 (its written using D6 which is the earliest version I still have but I think it will be OK) Drop your SQL into the SQLScript property, make sure each statement ends with a semicolon, and the last statement is the one you want to have produce the result set. Its almost like a query but you use ExOpen to run it. Roy Lambert Attachments: MultiQuery.bmp |
Tue, Jun 10 2014 6:59 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | HeiNi
I'm not sure just what you've done so I suggest your first move is to uninstall whatever it was you installed. When that's gone start again. The component as attached should need NO modifications so the first thing you did wrong was to alter the component name. The fact that you can't see the public procedure ExOpen says that something is very wrong. I've uninstalled DBISAM V2 again, and I have D6 but if you follow the instructions below it should work. 1. Save the attachment down to disk as DBISAMMultiQuery.pas - make sure you make a note of the directory you put it in 2. In D5 click Component | Install component 3. In unit file name navigate to where you saved DBISAMMultiQuery.pas and select it The dialog will probably tell you that the package file name is something like c:\program files\borland\delphi5\Lib\dclusr.dpk. Whatever else it should end in \dclusr.dpk 4. Click OK you will get a message along the lines of --------------------------- Confirm --------------------------- Package dclusr.bpl will be rebuilt. Continue? --------------------------- Yes No Help --------------------------- 5. Click yes and it will compile You should then be told that the new component has been added. If not minimise the code window and you'll see a box showing the package dclusr. Click compile, click install (if its enabled) If it still doesn't install then I'm stuck. Roy Lambert |
Tue, Jun 10 2014 7:36 AM | Permanent Link |
HeiNi | Hi Roy,
it's working. I gess my mistake was using a new package for the component because I feard to damage the dclusr.dpk. I don't know why the name of the component I strored was TDBISAMMultiQuery.pas and why I had to change it to DBISAMMultiQuery.pas. Now I downloaded it again and it worked. I even succeeded in changing the symbol to the one I attached previously. I hope I didn't bother you. I'm no software engineer but a hospital pharmacist. Heiko Roy Lambert wrote: HeiNi I'm not sure just what you've done so I suggest your first move is to uninstall whatever it was you installed. When that's gone start again. The component as attached should need NO modifications so the first thing you did wrong was to alter the component name. The fact that you can't see the public procedure ExOpen says that something is very wrong. I've uninstalled DBISAM V2 again, and I have D6 but if you follow the instructions below it should work. 1. Save the attachment down to disk as DBISAMMultiQuery.pas - make sure you make a note of the directory you put it in 2. In D5 click Component | Install component 3. In unit file name navigate to where you saved DBISAMMultiQuery.pas and select it The dialog will probably tell you that the package file name is something like c:\program files\borland\delphi5\Lib\dclusr.dpk. Whatever else it should end in \dclusr.dpk 4. Click OK you will get a message along the lines of --------------------------- Confirm --------------------------- Package dclusr.bpl will be rebuilt. Continue? --------------------------- Yes No Help --------------------------- 5. Click yes and it will compile You should then be told that the new component has been added. If not minimise the code window and you'll see a box showing the package dclusr. Click compile, click install (if its enabled) If it still doesn't install then I'm stuck. Roy Lambert |
Tue, Jun 10 2014 8:37 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | HeiNi
>I'm no software engineer but a hospital pharmacist. You sort only bother me when you give me the wrong pills As a community we generally try to help, and we have a fair degree of patience with those less used to the product. Glad we could help and its working. Roy Lambert |
Tue, Jun 10 2014 9:11 AM | Permanent Link |
HeiNi | Hi Roy
> You sort only bother me when you give me the wrong pills I try to keep the doctors from doing this. If you ever need help with medicines don't hesitate to ask me Heiko |
« Previous Page | Page 2 of 3 | Next Page » |
Jump to Page: 1 2 3 |
This web page was last updated on Sunday, May 19, 2024 at 08:46 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |