Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 8 of 8 total |
Why Does TDataset Insert Fail? |
Tue, Aug 28 2012 1:45 AM | Permanent Link |
Frederick Chin | In the code below, the compilation fails at the "insert;" line with an error, among others, of:-
[Error] main.wbs (76,15): Expected ( but instead found ; with dsLoanAmounts do begin insert; // Compilation stops here columns['loanamt'].asFloat:=1.00; save; end; If I prefix all three lines within the "with" block with the dataset's name plus a dot, the compilation proceeds. It looks OK to me. Frederick |
Tue, Aug 28 2012 10:14 AM | Permanent Link |
Raul Team Elevate | This looks to be a bug - that Insert is not accepted inside with block.
with dsLoanAmounts do begin dsLoanAmounts.insert; columns['loanamt'].asFloat:=1.00; save; end; Tim needs to fix this. Raul On 8/28/2012 1:45 AM, Frederick Chin wrote: > In the code below, the compilation fails at the "insert;" line with an error, among others, of:- > > [Error] main.wbs (76,15): Expected ( but instead found ; > > with dsLoanAmounts do begin > insert; // Compilation stops here > columns['loanamt'].asFloat:=1.00; > save; > end; > > If I prefix all three lines within the "with" block with the dataset's name plus a dot, the compilation proceeds. > > It looks OK to me. > > Frederick > |
Tue, Aug 28 2012 11:23 AM | Permanent Link |
Friedrich Westermann | Thats really easy:, never use with......
it looks nice at the first point but after... you remember the problems with the latest changes in Delphi? Trect becames width, height etc. propertys so: NEVER USE WITH!!!!!!!!!!! Greeting Fritz Frederick Chin wrote: > > [Error] main.wbs (76,15): Expected ( but instead found ; > > with dsLoanAmounts do begin > insert; // Compilation stops here > columns['loanamt'].asFloat:=1.00; > save; > end; > |
Tue, Aug 28 2012 11:51 AM | Permanent Link |
Frederick Chin | /*
"Friedrich Westermann" wrote: Thats really easy:, never use with...... */ I don't think using WITH is a bad thing since it makes code easier to read but can make debugging difficult. If a programmer is fine with it and knows what they are doing, why not? Besides, Tim knows that it is not bad thing since the online manual for EWB is full of WITH syntax. My code is practically lifted from his online manual. Frederick |
Wed, Sep 5 2012 10:08 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Frederick,
<< In the code below, the compilation fails at the "insert;" line with an error, among others, of:- >> Insert() is an internal system function: http://www.elevatesoft.com/manual?action=viewtopic&id=ewb1&topic=Insert and the compiler always gives scope preference to internal system functions *first* before any internal method names. Tim Young Elevate Software www.elevatesoft.com |
Thu, Sep 6 2012 12:11 PM | Permanent Link |
Frederick Chin | Tim,
/* Insert() is an internal system function: http://www.elevatesoft.com/manual?action=viewtopic&id=ewb1&topic=Insert and the compiler always gives scope preference to internal system functions *first* before any internal method names. */ Understood, but the following block:- with dtaSet do begin insert; end; is the same as :- dtaSet.Insert; Why should the compiler choke when the insert() in the block is dot suffixed to dtaSet. In fact, in your online manual for "Updating Datasets", you have the very same example of the insert command within the With statement. Would that compile? Frederick |
Thu, Sep 6 2012 3:06 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Frederick,
<< is the same as :- dtaSet.Insert; >> No, it's not, as far as the compiler is concerned. It's a little hard to explain, but it has to do with the fact that these internal system functions don't actually exist in Object Pascal code anywhere, only in JavaScript. Therefore, the compiler can't "select" them properly by declaration, only by name. It's something that will be addressed, but requires some fundamental changes in how such internal system functions are dealt with by the compiler. << In fact, in your online manual for "Updating Datasets", you have the very same example of the insert command within the With statement. Would that compile? >> This as an error in the manual, and has been correct along with an inline comment about why the Insert method needs to be prefaced with the dataset name. BTW, I was able to break out the ShowMessage/MessageDlg calls as separate procedures for EWB 1.01. The protected method reference requirement was actually a remnant of an earlier version of the compiler. It makes referencing this procedures more akin to Delphi. Tim Young Elevate Software www.elevatesoft.com |
Thu, Sep 6 2012 10:30 PM | Permanent Link |
Frederick Chin | Tim,
/* This as an error in the manual, and has been correct along with an inline comment about why the Insert method needs to be prefaced with the dataset name. */ OK, I guess there is no choice but to type more. /* BTW, I was able to break out the ShowMessage/MessageDlg calls as separate procedures for EWB 1.01. The protected method reference requirement was actually a remnant of an earlier version of the compiler. It makes referencing this procedures more akin to Delphi. */ Great! Thanks. Frederick |
This web page was last updated on Thursday, December 5, 2024 at 09:15 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |