Jump to content

WalkingAway

Members
  • Content Count

    27
  • Joined

  • Last visited

Community Reputation

1 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. WalkingAway

    RefreshUnknownRecord, FDQuery

    Hi. I use the RefreshUnknownRecord function to manually add rows (bypassing Fetch) together with "normal" Fetch (with fmOnDemand and RecsMax, RowSize etc.). I have side effect, I will try to describe it: 1) Fetched first 100 tuples (let say Id is from 1 to 100) 2) With RefreshUnknownRecord added row with id = 101 3) Fetched second 100 tuples (id from 101 to 200). In this situation I have row 101 duplicated. Is there any way to awoid this? I think to implement some kind of array of variant for keeping records added with RefreshUnknownRecord and checking in OnFecth event and skeep them (as already present). Thank you.
  2. I have such a test classes (copy of TFDAdaptedDataSet, TFDCustomMemTable and TFDMemTable): unit xDataSet; interface uses System.SysUtils, System.Classes, Data.DB, FireDAC.Comp.DataSet, Firedac.Stan.Def, Firedac.Stan.Param, Firedac.Stan.Option, Firedac.DatS, Firedac.Phys.Intf; type TxBaseDataSet = class(TFDDataSet) private { Private declarations } protected { Protected declarations } public { Public declarations } constructor Create(AOwner: TComponent); override; destructor Destroy; override; { TFDDataSet } property FetchOptions; property FormatOptions; property ResourceOptions; property SecurityOptions; property UpdateOptions; published { Published declarations } end; TxCustomDataSet = class(TxBaseDataSet) private FOptionsIntf: IFDStanOptions; protected FStoreDefs: Boolean; property StoreDefs: Boolean read FStoreDefs write FStoreDefs default False; // IFDStanOptions function GetOptionsIntf: IFDStanOptions; override; procedure GetParentOptions(var AOpts: IFDStanOptions); public constructor Create(AOwner: TComponent); override; destructor Destroy; override; end; TxDataSet = class(TxCustomDataSet) published property ActiveStoredUsage; { TDataSet } property Active; property AutoCalcFields; property BeforeOpen; property AfterOpen; property BeforeClose; property AfterClose; property BeforeInsert; property AfterInsert; property BeforeEdit; property AfterEdit; property BeforePost; property AfterPost; property BeforeCancel; property AfterCancel; property BeforeDelete; property AfterDelete; property BeforeScroll; property AfterScroll; property BeforeRefresh; property AfterRefresh; property OnCalcFields; property OnDeleteError; property OnEditError; property OnNewRecord; property OnPostError; property FieldOptions; property Filtered; property FilterOptions; property Filter; property OnFilterRecord; property ObjectView default True; property Constraints; property DataSetField; property FieldDefs stored FStoreDefs; { TFDDataSet } property CachedUpdates; property FilterChanges; property IndexDefs stored FStoreDefs; property Indexes; property IndexesActive; property IndexName; property IndexFieldNames; property Aggregates; property AggregatesActive; property ConstraintsEnabled; property MasterSource; property MasterFields; property DetailFields; property OnUpdateRecord; property OnUpdateError; property OnReconcileError; property BeforeApplyUpdates; property AfterApplyUpdates; property BeforeGetRecords; property AfterGetRecords; property AfterGetRecord; property BeforeRowRequest; property AfterRowRequest; property BeforeExecute; property AfterExecute; property FetchOptions; property FormatOptions; property ResourceOptions; property SecurityOptions; property UpdateOptions; { TxCustomCustomDataset } property StoreDefs; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; end; procedure Register; implementation procedure Register; begin RegisterComponents('Samples', [TxDataSet]); end; { TxBaseDataSet } constructor TxBaseDataSet.Create(AOwner: TComponent); begin inherited Create(AOwner); end; destructor TxBaseDataSet.Destroy; begin inherited Destroy; end; { TxustomCustomDataset } constructor TxCustomDataSet.Create(AOwner: TComponent); begin inherited Create(AOwner); end; destructor TxCustomDataSet.Destroy; begin Close; Destroying; inherited Destroy; if FOptionsIntf <> nil then begin FOptionsIntf.ObjectDestroyed(Self); FOptionsIntf := nil; end; end; function TxCustomDataSet.GetOptionsIntf: IFDStanOptions; begin if FOptionsIntf = nil then FOptionsIntf := TFDOptionsContainer.Create(Self, TFDFetchOptions, TFDBottomUpdateOptions, TFDBottomResourceOptions, GetParentOptions); Result := FOptionsIntf; end; procedure TxCustomDataSet.GetParentOptions(var AOpts: IFDStanOptions); begin AOpts := nil; end; { TxDataSet } constructor TxDataSet.Create(AOwner: TComponent); begin inherited Create(AOwner); end; destructor TxDataSet.Destroy; begin inherited Destroy; end; end. Nothing wrong here. But I can not add quite simple thing - I want to override FetchOptions.Mode (let say, it alway has to be fmAll - no metter what was set in design time). What I see - value from design time is always som how written in the end. So, when I put FetchOptions.Mode = fmAll to all three available Create methods - constractors, nothing changes. How to do it? Also, if I put component to form and ask its mode, it is always what was set in design time. procedure TForm22.Button1Click(Sender: TObject); begin case xDataSet1.FetchOptions.Mode of fmAll: begin ShowMessage('fmAll'); end; fmExactRecsMax: begin ShowMessage('fmExactRecsMax'); end; fmManual: begin ShowMessage('fmManual'); end; fmOnDemand: begin ShowMessage('fmOnDemand'); end; end; end; Thank you.
  3. Hi there! As it turns out, my question is intertwined with this article from @Uwe Raabe https://www.uweraabe.de/Blog/2020/10/04/tweaking-dfm-loading/ The example in this article does not take into account adding (editing only), and here is implemented absolutely what I'm looking for - in the main form / edit form is used different datasources. So, if save the record, I just need only to call Refresh method for retrieving new / updated values for only one record. At least it should work. But still not understand, how to do it in case of adding new record (employee in that case) - if I put dsData.DataSet.Insert (for editing dsData.DataSet.Edit do the job), I can't call Refresh (or it has no sence probabaly), I even can't temporaraily Post (user probably can press "Cancel" later - no adding at all) Thanks. TweakingDFMLoading.zip
  4. I want to have list of documents in one form (simple query) and edit form for particular document in other form (extended query). In simplier case - when the same query is used - I have no problems at all, everything is clear. Goal is to have simple / light query for list (let say, common fields - id, name) and more extended version for edit form (almost every field included) potentially with master / detail and CachedUpdates. Editing case itself I can imaging (how to implement), but what about adding? Especially if user cancel adding. I mean how to link both queries as it was the same (actually both queries for the same document) - if editor is closed (and product was created), how to update list (not update, but refresh one row). Thank you in advance!
  5. WalkingAway

    [MidWare] MidWare, Delphi 12

    François, thank you for your work. It so nice that it is open project and possible to get know how it works. I have builded all the samles and their are working. My questions were based just in found cooments - those SSL and ZHL features. Probably in some point it was implemented (or was some tryout to implement). Also was found some comment about unicode, it was also asked. Thank you.
  6. WalkingAway

    [MidWare] MidWare, Delphi 12

    Thank you so much. It is very useful to know in advance what feature is impossible to find. But itself your framework / libaray is quite good base for simple / educational projects. Thanks.
  7. Just for education purpose decided to test Midware (with Rio additions). In general, it works, but: 1) can get it working with SSL - there is no TSslAppSrvClient component. Do I have use "normal" TAppSrvClient instead? 2) lzh not working - MidWare implementation has f.e. EncryptGetBytes method and second param is LongWord (but in lzh.pas wich was found in internet it has type Word). 3) Is this library support unicode? Can somebody explain me what can I do in order to get it working?
  8. WalkingAway

    Bindings problem

    Solution found Just changed dasetfield from string ti wide string
  9. WalkingAway

    Bindings problem

    Hello I have problem. FMX and Android, TListView with binded DataSet. Phone is EN, but Text := 'äÄåÅ' (SCANDINAVIAN); Items when binded - not displayed properly, but this working correctly: procedure TForm5.ListView1ItemClick(const Sender: TObject; const AItem: TListViewItem); begin AItem.Text := 'äÄåÅ'; end; How to solve this problem? Thank you
  10. WalkingAway

    RTTI and not ordinary data type

    I have here such a sample app. This app using StandFrame component, but it can be plain / pure frame based app. Main question here is: Every frame has "meta" - information about itself (managed by FrameStand), and code is basically the same: procedure TMainForm.PictureButtonClick(Sender: TObject); var LFrameInfo: TFrameInfo<TPictureFrame>; begin LFrameInfo := FrameStand1.New<TPictureFrame>(); LFrameInfo.Frame.Description := 'Example description'; LFrameInfo.Show; end; procedure TMainForm.TextButtonClick(Sender: TObject); var LFrameInfo: TFrameInfo<TTextFrame>; begin LFrameInfo := FrameStand1.New<TTextFrame>(); LFrameInfo.Frame.Text := 'Example text'; LFrameInfo.Show; end; What I did here - one method for all frames (working) function GetFrameInfo<T>: TFrameInfo<T>; begin Result := FrameStand1.New<T>(); Result.Show; end; I'm able to set via RTTI "Text" property in one frame and "Description" in other as they are strings. For simple types it easy. But let's consider there property "MainFrame", it's type is TFrameInfo<T> or TFrameInfo<TFrame>. How to set it with RTTI? Because then I want to link it in the same manner to ListView like AItem.Data[ 'freame_info' ].AsType< TFrameInfo< TFrame > >; And then by clicking to open according frame. I don't entirely understand how to make RTTI understand my TFrameInfo<TFrame >> Thanks in advance demo.zip
  11. WalkingAway

    RTTI and not ordinary data type

    Is it possible to get / set through RTTI non standard type value? I tries, but always got something like 'invalid tapecast' error. Let say I have TFrameMeta<T: TFrame> = class(TGlobalMeta) TGlobalMeta here is: TGlobalMeta = class private What I want - to unified opportunity to set / get "Meta" value , it can be FirstFrame.Meta, SecondFrame.Meta, ... Now I have to write if FirstFrame.Meta is AccountFrame then ... else if FirstFrame.Meta is ReportFrame If I have 50 frames it is too boring. RTTI may help me Or maybe mnthere some libraries for that Thank a lot Also I want to link that kind of link to "Meta" to listview (TValue.From) for same purpose. With no success also so far...
  12. Hi there I have read pretty a lot topics about data-aware components. There are a lot of even funny / useless examples (as examples I put here, found in internet, not mine code). Thinkg about this panel component.... Is it possible to add master-detail feature? Basically, all I need is like cached update. Short example: there are tables "Queries" and "Fields". If user adds / deletes / updates some fields, I want to save either all (both "Queries" and "Fields") or do nothing. Because if user decided to cancel editing - there is no way to do it. Is it possible? Or may be somewhere is component already with suach an option? What I can probably do for now - put all data to tlist, may be then for save I have to loop through manually... Thanks. uDBCalendarView.pas uDBPanel.pas
  13. WalkingAway

    Spring4D + DSharp = RAD Alexandria

    Some debug info. Here is error in this line, "TRttiNamedObject.Name" is nil (abstract error). Probably this is the key difference (new method in Alexandria) and cause of abstract error , but I'm not able to correct this: In Rio working as well both libraries. Hope, maybe some day DSharp will be compatible with Springs 2.
  14. WalkingAway

    Spring4D + DSharp = RAD Alexandria

    thanks Or at least he makes v1 compatible with Alexandria
×