pro_imaj Posted December 17, 2022 Share Posted December 17, 2022 Hi, The TUniDBFormattedNumberEdit component does not have a property where I can change the blankvalue. Calculations are wrong because it returns -1 if there is no value in the field. How do I make the value 0, which is -1 in case of blankvalue, when there is no data? When there is a blankvalue in the TUniDBFormattedNumberEdit component, it solves this problem by setting it to 0. What is the solution in DB component? Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted December 19, 2022 Author Share Posted December 19, 2022 Is there a way to set the TUniDBFormattedNumberEdit blankvalue? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2022 Share Posted December 19, 2022 On 12/17/2022 at 6:16 PM, pro_imaj said: Calculations are wrong because it returns -1 if there is no value in the field. How do I make the value 0, which is -1 in case of blankvalue, when there is no data? Hello, Sorry, how can we reproduce this? Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted December 19, 2022 Author Share Posted December 19, 2022 3 minutes ago, Sherzod said: Hello, Sorry, how can we reproduce this? @Sherzod Hi Add 1 TUniDBFormattedNumberEdit to the screen and connect any datasource. The default value is 0. When you delete the 0 value, it becomes -1, so if there is no data on the screen, it becomes -1, I have to make it 0. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2022 Share Posted December 19, 2022 @pro_imaj This post? Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted December 19, 2022 Author Share Posted December 19, 2022 49 minutes ago, Sherzod said: @pro_imaj This post? @Sherzod None of these solutions worked. I just couldn't try this; There is no blur in the ExtEvents event of the TUniDBFormattedNumberEdit component, so I couldn't test it. UniNumberEdit -> ClientEvents -> ExtEvents -> blur Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2022 Share Posted December 19, 2022 I will try to check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2022 Share Posted December 19, 2022 2 hours ago, pro_imaj said: Add 1 TUniDBFormattedNumberEdit to the screen and connect any datasource. The default value is 0. When you delete the 0 value, it becomes -1, so if there is no data on the screen, it becomes -1, I have to make it 0. I couldn't reproduce your issue. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2022 Share Posted December 19, 2022 On 12/17/2022 at 6:16 PM, pro_imaj said: The TUniDBFormattedNumberEdit component does not have a property where I can change the blankvalue. What properties did you change? Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted December 19, 2022 Author Share Posted December 19, 2022 The example is attached. Value should be 0 when there are no values. test02.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2022 Share Posted December 19, 2022 I will check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2022 Share Posted December 19, 2022 On 12/17/2022 at 6:16 PM, pro_imaj said: The TUniDBFormattedNumberEdit Or UniNumberEdit !? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2022 Share Posted December 19, 2022 39 minutes ago, pro_imaj said: The example is attached. Value should be 0 when there are no values. test02.zip 26.75 kB · 1 download procedure TMainForm.edtTeklifYuzdeChangeValue(Sender: TObject); begin //UniNumberEdit1.Value := edtTeklifYuzde.Value; if edtTeklifYuzde.Value < 0 then UniNumberEdit1.Value := 0 else UniNumberEdit1.Value := edtTeklifYuzde.Value; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 19, 2022 Share Posted December 19, 2022 Another solution: 1. procedure TMainForm.edtTeklifYuzdeChangeValue(Sender: TObject); begin //UniNumberEdit1.Value := edtTeklifYuzde.Value; //if edtTeklifYuzde.Value < 0 then // UniNumberEdit1.Value := 0 //else // UniNumberEdit1.Value := edtTeklifYuzde.Value; end; 2. procedure TMainForm.edtTeklifYuzdeChange(Sender: TObject); begin UniNumberEdit1.Value := edtTeklifYuzde.Value; end; 3. procedure TMainForm.UniFormCreate(Sender: TObject); begin FDMemTable1.Append; FDMemTable1.Edit; with TUniNumberEdit(edtTeklifYuzde) do begin BlankValue := 0; AllowBlank := True; end; end; Quote Link to comment Share on other sites More sharing options...
pro_imaj Posted December 19, 2022 Author Share Posted December 19, 2022 4 hours ago, Sherzod said: Another solution: 1. procedure TMainForm.edtTeklifYuzdeChangeValue(Sender: TObject); begin //UniNumberEdit1.Value := edtTeklifYuzde.Value; //if edtTeklifYuzde.Value < 0 then // UniNumberEdit1.Value := 0 //else // UniNumberEdit1.Value := edtTeklifYuzde.Value; end; 2. procedure TMainForm.edtTeklifYuzdeChange(Sender: TObject); begin UniNumberEdit1.Value := edtTeklifYuzde.Value; end; 3. procedure TMainForm.UniFormCreate(Sender: TObject); begin FDMemTable1.Append; FDMemTable1.Edit; with TUniNumberEdit(edtTeklifYuzde) do begin BlankValue := 0; AllowBlank := True; end; end; Hi @Sherzod I solved the problem with item 3. Thank you very much. This error occurred because I couldn't make edtOfferYuzde.BlankValue := 0; These standards should be added to the component specifications. @Farshad Mohajeri Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.