-
Content Count
315 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Serge_G
-
Thanks, Dmitry, I was not aware of this special construction to remap a column. This does the trick πββοΈ and brighten my day
-
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
-
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
-
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';
-
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
-
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
-
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
-
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.
-
My guess it's not RestDebugger but a somewhat regression of TRestResponse, I will investigate this direction before disclaim in Quality Support
-
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 ?)
-
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.
-
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.
-
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
-
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)
-
I was surprised I can use also this Disconnect with Firebird the same way I just calculate the Recsmax to be function of ListViewSize and ItemsHeight (in the onResize of the form so I detect rotation) FetchOptions.Recsmax:=Round(ListView1.Height/ListView1.ItemAppearance.ItemHeight); And no more cursors see my first attempts here https://www.developpez.net/forums/d2099624/environnements-developpement/delphi/composants-fmx/tlistview-pagine-j-ai-besoin-quelques-suggestions/#post11666050 Not updated because I prefered to make a test on Firebird AND SQlite (on windows) . Added the navigation to a page number (problem ok virtual keyboard solved). Last but not least : implementing the search is the last goal I fixed but not code yet
-
Hi, In the old days a simple backup (transportable format) from Interbase, and restore in Firebird works, but I don't know if this solution works now.
-
Try this dm.fdc.ExecSQL( 'UPDATE tbCalendar SET EventDate = :pEd, Event = :pEv, EventTime = :pEt, Venue = :pVe, EventType = :pEvt, [Order] = :pOr, Competition = NULL ' + ' WHERE ID = :pID', [ dDate, edEvent.Text, edTime.Text, cbVenue.Text, cbType.Text, StrToInt(cbOrder.Text), iMatchID ]); And for setting a Field to null dm.fdqvCalendar.FieldByName('Competition').Clear;
-
Hi, @Emailx45 Test have to be done on a SQlite Database, surprisingly the sequence FDQuery1.Close; FDQuery1.FetchOptions.RecsSkip := FDQuery1.FetchOptions.RecsSkip - lMyMaxRecordsByPage; FDQuery1.Open(); Does not work, but if you use FDQuery1.Disconnect it is ok. Note I prefer your EOF management to mine π, done quickly. @sjordi Now you put this in my mind I am thinking on how pages number can be displayed like what can be seen on the web (the <1 2 3 .. x > thing) and how search can be implemented (certainly a firedac macro ) . I think it's a more a gesture management sort of than a ScrollViewChange
-
Ok, so with a SQLite the same code does not work But changing fdQuery1.Open to FdQuery1.Disconnect Do the trick. I was not aware of this "disconnect" function
-
Hi, I never tried this approach but curious I am π I think you simply forget to refresh the link. I wrote a little program to check (Firebird database for instance, further I will write one with SQLite to be sure) here is my thougts uses System.Math; procedure TForm3.btnFirstClick(Sender: TObject); begin FDQuery1.Open(); LinkListControlToField1.Active:=true; end; procedure TForm3.btnPriorPageClick(Sender: TObject); begin fdQUery1.Close; fdQuery1.FetchOptions.RecsSkip:=MaxIntValue([FDQuery1.FetchOptions.RecsSkip-FDQuery1.FetchOptions.RecsMax,-1]); fdquery1.Open; LinkListControlToField1.Active:=False; LinkListControlToField1.Active:=true; end; procedure TForm3.btnNextPageClick(Sender: TObject); var skiprec : Integer; begin if fdQuery1.EOF OR (fdQuery1.RecordCount<FDQuery1.FetchOptions.RecsMax) then exit; skipRec:=FDQuery1.FetchOptions.RecsSkip+FDQuery1.FetchOptions.RecsMax; fdQUery1.Close; fdQuery1.FetchOptions.RecsSkip:=skipRec; fdquery1.Open; LinkListControlToField1.Active:=False; LinkListControlToField1.Active:=true; end; Even if I am a little disappointed by my EOF management (in my sample RecordCountCodeMode need to to be cmVisible) this little test works.
-
How did you manage that ? Using AnyDac component yes it works, but I don't achieve that with Firedac, FDPhysFBDriverLink is not available for AndroΓ―d. Using FDPhysIBDriverLink and changing library I always run in a "connection rejected by host" error (32 bits client/server app) Using a 7.2 later beta ZEOSDBO I managed to get access to Firebird, but with the newer versions I can't even access to library !
-
Hi, Try a ScrollBox. Have a look to Paul Toth and Andriano Santos solutions but also Jaques Nascimento tips
-
livebindings without livebindings designer , code only
Serge_G replied to FranzB's topic in Databases
Well, , I only test Fluent Livebindings with a TGrid, not TStringGrid, but demo included in the package is with a stringgrid, so I don't see anything except a missing unit in your form. My tests are somewhere a little not objectives in the way I put on the same form a grid linked (TBindGridLink) with the visual livebindings editor and another with Fluent (raising the fact this last is not a WYWSSEWYG method) unit so all the units were added. -
livebindings without livebindings designer , code only
Serge_G replied to FranzB's topic in Databases
Yes FluentLiveBindings should work, and so easy to write BindingsList1.BindGrid(Grid1).ToBindSource(BindSourceDB1); But no CustomFormat can be used (perhaps I don't know how, or further development ?) My code for runtime linking var ABindGrid : TBindGridLink; begin ABindGrid:=TBindGridLink.Create(self); ABindGrid.ControlComponent := Grid1; ABindGrid.SourceComponent := BindSourceDB1; // synch with ABindGrid.PosControlExpressions.AddExpression do begin ControlExpression := 'Selected'; SourceExpression := 'Math_Max(0,DBUtils_ActiveRecord(Self))'; end; with ABindGrid.PosSourceExpressions.AddExpression do begin ControlExpression := 'Math_Max(1,Selected+1)'; SourceExpression := 'DBUtils_ValidRecNo(Self)'; end; // columns with ABindGrid.ColumnExpressions.AddExpression do begin ColumnName := 'Column1'; ColumnIndex := 0; SourceMemberName := 'SS_NUMBER'; // field format '0 000 000 00' (a crazy one ;-) just for test) with FormatCellExpressions.AddExpression do begin ControlExpression := 'Data'; SourceExpression := 'DisplayText'; // I kept Display text, but 10.4.1 don't need end; end; with ABindGrid.ColumnExpressions.AddExpression do begin ColumnName := 'Column2'; ColumnIndex := 1; SourceMemberName := 'FIRST_NAME'; With FormatCellExpressions.AddExpression do begin ControlExpression := 'Data'; SourceExpression := 'Value+'#39' '#39'+Dataset.LAST_NAME.text'; end; end; Regret, I am unable to use a "with TBindGridLink.Create(Self) do ...." form -
Hi, It seems too late but you can look at my (sorry french) paper about customizing Grid https://serge-girard.developpez.com/tutoriels/Delphi/Livebindings/Grilles/ Ok it's not about headers it's one of the Todo in my notebook I had no time to investigate (I go on listviews instead of grids) but still in my mind I think about a new column style