allenchow Posted September 29, 2020 Share Posted September 29, 2020 I have a field with integer value either 0 or 1 (with checkboxfield enabled) . When I click the checkbox directly, it has no problem. But if I edit other field with row editor opened, then I click the checkbox and confirm, error occur: "Could not convert variant of type (Null) into type (OleStr)." Please check and fix it ! Thanks ! Quote Link to comment Share on other sites More sharing options...
allenchow Posted September 29, 2020 Author Share Posted September 29, 2020 It has no problem if the field is boolean type, but not if it's int type with values 0 and 1 Quote Link to comment Share on other sites More sharing options...
allenchow Posted September 29, 2020 Author Share Posted September 29, 2020 In the mean time, I've edit the unidbgrid.pas : function TUniCustomDBGrid.XlatValue(Col: TUniBaseDBGridColumn; Fld: TField; Val: Variant): string; ... if Col.CheckBoxField.Enabled and (not Col.CheckBoxField.BooleanFieldOnly) then begin S := Col.CheckBoxField.FieldValues; sArr := ExtractBooleanValues(S); if Length(sArr) > 0 then begin // changed by Allen 29/09/2020 if Val = Null then begin Result := sArr[1]; end else begin B := StrToBool(Val); if B then Result := sArr[0] else Result := sArr[1]; end; end; end Quote Link to comment Share on other sites More sharing options...
allenchow Posted September 29, 2020 Author Share Posted September 29, 2020 But another problem : When I edit the fields with roweditor, when I click the checkbox and edit the other field, only checkbox value saved and the value of the other field is not saved! Quote Link to comment Share on other sites More sharing options...
allenchow Posted September 29, 2020 Author Share Posted September 29, 2020 4 hours ago, allenchow said: But another problem : When I edit the fields with roweditor, when I click the checkbox and edit the other field, only checkbox value saved and the value of the other field is not saved! I've found that the problem is due to the AutoPost setting of the checkbox field !! It will neglect other edited value unless I put the checkbox field to the last column ! 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.