Jump to content

Serge_G

Members
  • Content Count

    311
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Serge_G


  1. Testing D12, I made small tests.

     

    First using 2 versions of Firebird (3 and 4) I made a mistake not using a TFDPhysFBDriver, default connection was using fb3 this mistake stop IDE !
     

    FDPhysFBDriver settled
    image.png.192f39d5c499c9b81a2ee91dbc7ce353.png

     

    I now run in another error with my French edition
    image.png.63cc8b318969f29b83d7b3a9f5999c65.png

     

    working with SQL
    image.thumb.png.27d628130e3f5d853418ef8d26240bc0.png

     

    To search :
     using FormatOptions (of the FDConnection.FDQuery or FDTable)
     using mappings
     


  2. 3 hours ago, Jeff Steinkamp said:

    Someone had mentioned using the BatchMove component,

    Perhaps me 😊 if so, in my mind it was like this, source is Database A, dest is Database B

    Source selection is a TFDQuery so you can restrict to what you need, this to respond your "truncating data"

    image.thumb.png.4649297d479859a11db8feea183f3653.png

    you just have to adjust properties of FDBatchMove,  depending on process you want (only appending, appending or updating see property mode)
    Note : keep in mind what you have to do with errors during the process. 3300 records is not so much.

     

    to be known, fdbatchmove have a contextual menu. The 3 first options are very useful and with the first one ( Execute) debugging is easy (without running program !)

    see https://docwiki.embarcadero.com/Libraries/Alexandria/en/FireDAC.Comp.BatchMove.TFDBatchMove and https://docwiki.embarcadero.com/CodeExamples/Alexandria/en/FireDAC.TFDBatchMove_Sample

     



  3. First declare fields
    Then set event on GetText for the field and code the event

     

    procedure TForm1.FDTable1Date_exitGetText(Sender: TField; var Text: string;
      DisplayText: Boolean);
    begin
    if Sender.IsNull then text:='n.d.'
                     else Text:=FormatDateTime('mm-dd-yyyy',UnixToDateTime(Sender.Value));
    end;


    image.thumb.png.a2fe993fedb2834cc34ddcdb081ff0c0.png

    on design date_exit should be an integer but at run time "magic" happens
    image.thumb.png.72055711581d297c7d295043937112d0.png

     

    Now let speak about another method for Timestamp type (my date_create)
    You just have to set property displayformat

    image.png.223c492bd6a343aee1c1de9f0f62c94a.png
    to get the date_create formatted at runtime but also at design time (yellow)

     

    image.thumb.png.127c3299b19f8020c8ad1a8b6cbe74c1.png

    • Like 1

  4. One solution is to use DynamicAppearance and add an image.

    I explained this (in french) here and there
    The only job to add is to rework the bitmap to have RoundedCorners in this part

    procedure TForm1.ListView1UpdatingObjects(const Sender: TObject;
      const AItem: TListViewItem; var AHandled: Boolean);
    var AListItemBitmap : TListItemImage;
        AListItemText : TListItemText;
        AColor : TAlphaColor;
    begin
    AListItemBitmap:=AItem.Objects.FindObjectT<TListItemImage>('Image2');
    AListItemText:=AItem.Objects.FindObjectT<TListItemText>('Text1');
    
    if assigned(AListItemBitmap) then
     begin
        AListItemBitmap.Bitmap:=TBitmap.Create(40,40);
        try
           AColor:=StringToAlphaColor(AListItemText.Text)
        except 
          AColor:=TAlphaColorRec.Null;
        end;
        AListItemBitmap.Bitmap.Clear(AColor);
     end;
    end;

    image.thumb.png.5119ade116fafe397ab775600f601ddc.png

     

    Still some work to do but a first result

     


  5. You don't gave us the SGBD used. 

    Code can be reduced, without an FDQuery using FDConnection

     

     var x:=FDConnection1.ExecSQLScalar('SELECT 1 FROM WeighingCows WHERE Cownumber = :C', Drivers.DBEdit1.Text);

     if varisnull(x) then begin
       MessageDlg('This number exist', mtError, [mbOK], 0);
      FDTable1.Cancel;<<<<<<<<<<< if execute then OK 
      end;

     


  6. 1 hour ago, Alexander Halser said:

    Where do you see a problem here?

    Sorry for that, I saw that form2 was created once. I am not adept of that, preferring a modalform.Create and modalform.release in my apps

     

    1 hour ago, Alexander Halser said:

    StyleBookLight is not required to produce the problem.

    Yes, but it's a lot perturbing for me

    To answer this usage of old style usage

     

    1 hour ago, Serge_G said:

    (don't remember circumstance) 

    retrieve my mind's ticket is here (Patrick Premartin is the reporter because I was lazy to do it :classic_wink:)

    french discussion here

     

    @XylemFlow

    procedure TForm1.CheckBox1Change(Sender: TObject);
    begin
      if CheckBox1.IsChecked then StyleBook:=StyleBookDark
                             else Stylebook:=StyleBookLight;
        UpdateStyleBook;
    end;
    procedure TForm1.MenuItem4Click(Sender: TObject);
    
    begin
      // Apply current style to modalform 
       Form2.StyleBook:=Stylebook;
       Form2.Showmodal
    end;

    tested with polardark_win and polarlight_win styles


  7. Hi,

    I think there are more than one coding errors 🙄
    i.e. ChildForm is not released, StyleBookLight don't contain data ....

     

    I worked a similar project last year, you can find here

    7 hours ago, Alexander Halser said:

    So I loaded my own dark skin into your dark stylebook.

    Guess what? Works like a charm,

    I had some similar problem using an old 10.2 style (don't remember circumstance) 
     


  8. 2 hours ago, grantful said:

    I am thinking of writing a new database

    table drinks

    table ingredients 

    table  directions

     

    i think this will be better to use

    Yes that was what I suggest more or less

     

    2 hours ago, grantful said:

    t seems to be a problem to grab all the strIngredians1,stringrediants2 etc from the same table and show them in a memo

    Not so, but database structure is not very pro. 


  9. For me, you complicate your life :classic_wink:

    21 hours ago, grantful said:

    I was trying to use the query for the listview.

    If you use livebindings and synchronize your datasource to the listview you don't have to add a query.

    23 hours ago, Serge_G said:

    I never test newline constant in an expression 🙄 something I should test soon 😄 I'm curious.

    I made some tests. Not so evident, I think the best way is to create a new method for livebindings (I explore this in this tutorial).

    For now, I just use a database (Firebird one) trick to get linebreak value and use CustomFormat:=%s+dataset.BR.text+dataset.stringrediants1.value+dataset.BR.text+dataset.stringrediants2.value+ ...

     

    Can you attach your database and I will write a quick program as demo ?  

     

    Attached a quick sample
    image.thumb.png.833a55d6bfae659f902af3659dc42d10.png

    image.thumb.png.cd8cf15ee452cfd35f535fd65ddaaef3.png

     

    Ok, I don't create UI to add some coktails, just respond to first question
    "show only the records based on the item i click in a listbox." (listview) 

    Cocktails.zip


  10. My desktop FMX apps are 32/64 bits windows and Linux, my firebirds install are 64 bits (default FB3 on port 3050, FB4 on 3054)

    And I don't have any problem with that.
    Even if I can also read server FB Database on Android, I tried to have full a Firebird  embedded on Android without success.

    18 hours ago, Blavatsky said:

    where does this code go >>> ? as an event ?, as a procedure ?

    This code is extracted from a procedure in my Datamodule

     

    18 hours ago, Blavatsky said:

    is this a good replica of what you are asking me to do in an English version of Delphi 11.1 ?

    Yes

     

    18 hours ago, Blavatsky said:

    Maybe it means my Version of Delphi 11.1 is a DUDD when it comes to Firebird 64 Bit. ???

    No


  11. 1) Drop a FDConnection  and set properties first one should be FBDriver 

    short response
    image.thumb.png.2b20f9d5d9680442f628ce77bc04b712.png

    long response

    eventually, you can change connection properties at runtime .

    As sample here what I use to connect my database 

    With ConnexionBase.Params as TFDPhysFBConnectionDefParams do
         begin
            UserName:=parametres.utilisateur;
            Password:=parametres.motdepasse;
            Server:=IP; // Ip addresse 
            Database:=Parametres.nombase;
            SQLDialect:=3;
         end;
      try
        ConnexionBase.Connected:=True;
        result:=true;
      except
        result:=false;
      end;

     

     

    2) Don't use " "  except if you need case-sensitive column names.

     Avoid * in your SQL. (If you use Flamerobin it's easy to generate SQL text)

     

    your SQL should be
     

    SELECT Index2,French,FrenchUTF,FrenchMod,English,Latin,Greek,Spanish,German,Chinese,Arabic,Russian,Italian,Pasigraphie,PasiImage,Notes
     FROM dictionary
     WHERE Index2 = :INDEX2 

    Note if you have this FDQuery you can code this 
     

    FDQuery1.open('',[valueof parameter]);   

    instead of

    FDQUery1.Close;
    // no need to change SQL Text every time
    FDquery1.ParamByName('Index2').asInteger:=xxx  // value of parameter
    fdquery1.Open;

     

    A tip : set  FdConnection.ConnectedStrorageUsage.auRuntime to false  

     

     


  12. Hi,

    First, all my tutorials are Here

     

    For your need, you can use CustomFormat property of the link (should something like %s+' '+dataset.stringrediants1.value+....) 

    I never test newline constant in an expression 🙄 something I should test soon 😄 I'm curious.

    but I suggest you to treat the problem at the datasource and concatenate the fields in your query (advantage 1 - readonly field, advantage 2 - speed)

×