Jump to content

Serge_G

Members
  • Content Count

    76
  • Joined

  • Last visited

Everything posted by Serge_G

  1. Serge_G

    TListView and Stylebook on 10.4

    I should not be so affirmative. @MarkShark it's a FMX.TListView not a VCL one. @Michele If you think : style of an item like for a FMX.TListBox, yes you can't change Item style. You can only change Appearance and only use one for all the list, The Dynamic appearance is one of the most adaptable. if you think : changing background colors you can You can see above a personalized style, quick done, I only change itembackground.Color and buttontext.Color (listviewappearance = ImageListItemRightButton)
  2. It's a "business layer" so I should say DataModule and perhaps TDataSource on Form Agree with haentschman but "Like" can't be "parametrized". Anyway you have the macro solution https://www.devart.com/mydac/docs/devart.dac.tcustomdadataset.macros.htm So your query should be like this Select * from <tablename> &where and the code and this should respond your second interrogation (you can even use a macro for table name Query.SQl.Text := 'select Bla from Bubb &where' Query.MacroByName('where').AsString := Format('WHERE FIELD1 LIKE %s AND FIELD2 LIKE %s',[QuotedStr('%'+value1+'%'),QuotedStr('%'+value2+'%')]); Query.Open;
  3. Serge_G

    TListView different background color for each item

    It depends on whether you are using a dynamic skin or not. I wrote a few posts and tutorials (in French) on the subject. Anyway if you can't read French, googletrad should be your friend blog : https://www.developpez.net/forums/blogs/138527-sergiomaster/ tutorials list : https://serge-girard.developpez.com/ in my mind this one https://serge-girard.developpez.com/tutoriels/Delphi/Livebindings/ListView/
  4. Serge_G

    fmx grid error

    Hi, I was afraid of, but no, I wrote a quick test (I don't use Grid often) and my conclusion is : no problem found.
  5. Hi, Maybe this is the same problem as arabic, a font problem and not a database problem. I don't remember in which post I saw that, but I remember changing some emb. units did the trick for arabic. ( changing those 3 files FMX.TextLayout.GPU, FMX.FontGlyphs and FMX.FontGlyphs.Android. )
  6. Serge_G

    ERD tool needed!

    What about free DBeaver ? https://dbeaver.io/
  7. Serge_G

    Database in Delphi

    Really ? IMHO, This would be a bad idea, if Firedac was not with Pro and Community (with no source is acceptable). Another pack of free component is ZEOSLIB (also named ZEOSDBO), also BDE Like, can be installed on Community Edition
  8. Serge_G

    Database in Delphi

    The best book I think about is Delphi in Depth : Firedac by Cary Jensen If your aim is FireBird don't use IB Components, well and even for Interbase Firedac is better. Firedac is BDE like so the step between D4 and D10.4 is not so large (for this point and with Firedac) Ok, so in this case, should I suggest to use SQLite and a GUI like SQLite Studio ?
  9. Serge_G

    SQLite, adding a function

    Hi, I am surely doing something wrong there, but I can't understand where. I wrote a FDSQLiteFunction (well more than one) All of these return me widestrings, I was expecting Currency, Date, Currency. Note, first one came from help http://docwiki.embarcadero.com/CodeExamples/Sydney/en/FireDAC.SQLite_Sample procedure TDM.FDSQLiteFunction1Calculate(AFunc: TSQLiteFunctionInstance; AInputs: TSQLiteInputs; AOutput: TSQLiteOutput; var AUserData: TObject); begin // from sample AOutput.AsCurrency := AInputs[0].AsCurrency * AInputs[1].AsInteger; end; procedure TDM.FDSQLiteFunctionAAAAMMJJ2DateCalculate( AFunc: TSQLiteFunctionInstance; AInputs: TSQLiteInputs; AOutput: TSQLiteOutput; var AUserData: TObject); var vSDate : String; vDate : TDate; begin vsDate:=AInputs[0].AsString; vDate:=EncodeDate(StrToInt(Copy(vsdate,1,4)), StrToInt(Copy(vsdate,5,2)), StrToInt(Copy(vsdate,7,2))); AOutput.AsDate:=vDate; end; procedure TDM.FDSQLiteFunctionMontantCalculate( AFunc: TSQLiteFunctionInstance; AInputs: TSQLiteInputs; AOutput: TSQLiteOutput; var AUserData: TObject); var vMontant : Currency; IMontant : String; begin IMontant:=AInputs[0].AsString; Vmontant:=StrToFloat(IMontant); if Ainputs[1].AsString='-' then vMontant:=Vmontant * -1; AOutput.AsCurrency:=vMontant; end; Don't understand why! Ok, it's at design time, but I think that matters.
  10. Hi, In other words how FMXStyleViewer manage to apply styles that are not windows'ones?
  11. Serge_G

    SQLite, adding a function

    I try this before Dmitry response, but does not work at design time for declaring fields (keep in mind : Livebindings) Thanks anyway. Is there anyway to flag discussion as solved on this forum?
  12. Serge_G

    SQLite, adding a function

    Thanks, Dmitry, I was not aware of this special construction to remap a column. This does the trick 🙇‍♂️ and brighten my day
  13. Serge_G

    SQLite, adding a function

    Well, I was thinking it was a sort of VCL vs FMX thing but no. If I look at your grid I see that resultmult column is as string (align left) Like me have a widestringfield object FDQuery1MNT: TWideStringField AutoGenerateValue = arDefault FieldName = 'MNT' Origin = 'MNT' ProviderFlags = [] ReadOnly = True Size = 32767 end And this is my problem, if you use Livebindings a real one at design time! A note for this function // Select id,montant,sens, // testmnt(sens,montant) as MNT, -- function1 // asIntvalue(sens) as IntSens, -- function2 // montant*asIntvalue(sens) MNTBIS from ecritures procedure TForm11.FDSQLiteFunction2Calculate(AFunc: TSQLiteFunctionInstance; AInputs: TSQLiteInputs; AOutput: TSQLiteOutput; var AUserData: TObject); begin try if AInputs[0].AsString='+' then AOutput.AsInteger:=1 else AOutput.AsInteger:=-1; except Aoutput.AsInteger:=0; end; end; if you declare fields at design time you have a widestringfield, no fields declared it is a largeint value and MNTBIS a currency value
  14. Serge_G

    SQLite, adding a function

    Well, there was a mistake in the database , column aInput[0] is a string in French format so with " ," as decimal point aInput[1] if a char '+' or '-'. Don't fire at the pianist, that's not my database! In the same way, the format of the date vDate:=EncodeDate(StrToInt(Copy(vsdate,1,4)), StrToInt(Copy(vsdate,5,2)), StrToInt(Copy(vsdate,7,2))); I am in doubt because of base 0,1 string and, yes, I forgot the StrToDateTimeDef but problem remains. I exposed my problem with the first fuction procedure TDM.FDSQLiteFunction1Calculate(AFunc: TSQLiteFunctionInstance; AInputs: TSQLiteInputs; AOutput: TSQLiteOutput; var AUserData: TObject); begin // from sample AOutput.AsCurrency := AInputs[0].AsCurrency * AInputs[1].AsInteger; end; And this one, see second picture, give me a widestring not a currency field
  15. Serge_G

    SQL Update Case When

    Hi, This one UPDATE CUSTOMER SET COUNTRY = Case When COUNTRY='USA' then :MYCOUNTRY When COUNTRY <> 'USA' then COUNTRY End should be replaced by UPDATE CUSTOMER SET COUNTRY='USA' WHERE COUNTRY=:MYCOUNTRY; And this UPDATE EMPLOYEE SET TAXBASE= Case When SHAREHOLDER='Y' then (BRUTSALARY * :EMPPORTION /100) * :TMONTH End end by UPDATE EMPLOYEE E SET E.TAXBASE=E.BRUTSALARY*:EMPORTION/100)*:TMONTH WHERE E.SHAREHOLDER='Y';
  16. Serge_G

    Sidney, RestDebuger and REST

    Hi I had the idea to migrate an application using TRestxxxxx from 10.3 to version 10.4 and bad news! 😖 With 10.3 Restdebugger proposed to copy: a THTTPBasicAutenthicator, a TRESTClient, a TRESTRequest, a TRESTResponse, a TRESTResponseDatasetAdapter and an FDmemTable. With 10.4 I only end up with the first 4 in itself, it wouldn't matter if I could later add the other two except that ... my results are not there, I should get several rows, I get only one So, my migration does not work. What note of release would I have missed ? How to do my migration in this case ! Rio Sidney
  17. Serge_G

    Sidney, RestDebuger and REST

    Well, my QP was for 10.4.1 not 10.4.2 and I was really surprise when Dimitry supplies RestDebugger of 10.4.2. But on another hand this gave me reason to expect correction with the future realease
  18. Serge_G

    Sidney, RestDebuger and REST

    Well this is a rule I knew and accept the warning, but anybody that can go to Quality Portal can see Dimitry response no ? And I think a good new have to be shared. Don't know how to mark solved on this forum
  19. Serge_G

    Sidney, RestDebuger and REST

    Hi, Dmitry gave me a look on 10.4.2 RestDebugger, problem solved. Patrick (another MVP beta tester of 10.4.2) confirm me that this new version works as I was expecting. So, I will wait for this new version.
  20. Serge_G

    Sidney, RestDebuger and REST

    My guess it's not RestDebugger but a somewhat regression of TRestResponse, I will investigate this direction before disclaim in Quality Support
  21. Serge_G

    Sidney, RestDebuger and REST

    Hi, I found the difference the content doesn't have any rootelement (list of accessible webapi) So the question now is "how to have the same behavior Rio ?" (a property I miss ?)
  22. Serge_G

    LiveBindings for TComponent

    Yes agree, but when I wrote my radiogroupbox every time I wanted to link the item value (text value) it was written to radiogroupbox.text The only track I saw was the 'somewhat' converter but never went so far.
  23. Serge_G

    LiveBindings for TComponent

    Hi, I just made a simple attempt that I reported in this (sorry french) tutorial https://serge-girard.developpez.com/tutoriels/Delphi/Livebindings/Composant_A/ hope, this help. But I got stuck writing another more complex one for a radiogroupbox, my guess : I need to define a somewhat converter. Alas, my various professional obligations make me constantly postpone the realization of the latter.
  24. Serge_G

    Recursive S.Proc

    Hi, Something like CREATE TABLE BOM ( ITEMNO VARCHAR(5), CHILDITEMNO VARCHAR(5), QTY INTEGER ); COMMIT; INSERT INTO BOM VALUES('AAA','AAA-1',2); INSERT INTO BOM VALUES('AAA-1','AAB',2); INSERT INTO BOM VALUES('AAA-1','AAC',3); SET TERM ^ ; CREATE OR ALTER PROCEDURE GETBOM ( ITEM varchar(5), QT integer ) RETURNS ( BOMITEM varchar(5), BOMCHILD varchar(5), BOMQTY integer ) AS DECLARE VARIABLE Q INTEGER; BEGIN FOR SELECT ITEMNO,CHILDITEMNO,QTY*:QT FROM BOM WHERE ITEMNO=:ITEM INTO :BOMITEM,:BOMCHILD,:BOMQTY DO begin SUSPEND; Q=:BOMQTY; IF (NOT BOMCHILD IS NULL) THEN BEGIN FOR SELECT BOMITEM,BOMCHILD,BOMQTY FROM GETBOM(:BOMCHILD,:Q) INTO :BOMITEM,:BOMCHILD,:BOMQTY DO SUSPEND; END END END^ SET TERM ; ^ SELECT BOMITEM, BOMCHILD, BOMQTY FROM GETBOM ('AAA', 1); Giving P.S. Note as I present my script (create table, populate, table etc.) , so it'is easy for anybody to test
  25. Serge_G

    Sql Update

    Hi, try to replace your SQL by this one (I don't use Interbase but Firebird) IMHO you will need a whatever rounding function for your result. And, well , I am not a fan of calculated columns in a table (except COMPUTED BY ones)
×