Answer the question
In order to leave comments, you need to log in
Why does the algorithm skip the entry in Query?
Good afternoon!
Here is the code for checking table records:
procedure TProdAdd.sBitBtn1Click(Sender: TObject);
begin
if OrderView.ZQueryBasket.Active = True then
OrderView.ZQueryBasket.Edit
else ShowMessage('Сообщение1');
if (Quantity.Text = '') or (Name.Text = '') then ShowMessage('Сообщение 2!')
else
begin
OrderView.ZQueryBasket.Post; // Проверка, если записей 3, то пересчитываем всем колонку "Сумма скидки"
OrderView.ZQueryBasket.Last;
if OrderView.ZQueryBasket.RecordCount > 2 then
begin
OrderView.ZQueryBasket.First;
while not OrderView.ZQueryBasket.Eof do
begin
OrderView.ZQueryBasket.Edit;
OrderView.ZQueryBasket.FieldByName('discount_price').Value := OrderView.ZQueryBasket.FieldByName('base_price').Value * 0.1;
OrderView.ZQueryBasket.Post;
OrderView.ZQueryBasket.Next;
end;
end;
end;
end;
Answer the question
In order to leave comments, you need to log in
if (OrderView.ZQueryBasket.Active = True) and then
OrderView.ZQueryBasket.Edit
else ShowMessage('Message1');
if (Quantity.Text = '') or (Name.Text = '') then ShowMessage('Message 2!')
else
begin
OrderView.ZQueryBasket.Post; // Check if there are 3 records, then recalculate the "Discount Amount" column for all
OrderView.ZQueryBasket.Last;
if OrderView.ZQueryBasket.RecordCount > 2 then
if ( OrderView.ZQueryBasket.Active = True ) and ( OrderView.ZQueryBasket.RecordCount > 2 ) then
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question