Updating values in a form

Hi,

I am developing a form which has the source table as ‘Despatch Calculation’. This table has a field called ‘Balance to sell’.The items and other fields on this form are updated by selectin the location and date filter on the top of the form. I hav a button in this form to update the ‘Balance to Sell’ field. It has to update this field from the ‘Sales Line’ table. Now it is updating properly only for a single row. But I want to update the same for the entire column at the same time when I click the update button. I have written the followin code on OnPush of the update button… Please can anyone lemme know what is stoppin in my code to update the entire column…

This is the code I have written…

IF NOT CONFIRM(‘Do you want to update the balance to sell ?’) THEN

EXIT;

recDCalc.RESET;

recDCalc.SETRANGE(recDCalc.“Forecast Location”,ForecastLoc);

recDCalc.SETFILTER(recDCalc.“Forecast Date”,’>=%1&<=%2’,“Forecast From”,“Forecast To”);

recDCalc.SETRANGE(recDCalc.“Item No.”,“Item No.”);

IF recDCalc.FIND(’-’) THEN

BEGIN REPEAT

recSL.RESET;

recSL.SETRANGE(recSL.“Document Type”,recSL.“Document Type” :: Order);

recSL.SETRANGE(recSL.“Location Code”,recDCalc.“Forecast Location”);

recSL.SETFILTER(recSL.“Shipment Date”,’>=%1&<=%2’,“Forecast From”,“Forecast To”);

recSL.SETRANGE(recSL.“No.”,recDCalc.“Item No.”);

IF recSL.FIND(’-’) THEN

REPEAT

recDCalc.“Balance to Sell” += recSL.“Outstanding Quantity”;

UNTIL recSL.NEXT = 0;

recDCalc.MODIFY;

UNTIL recDCalc.NEXT = 0;

END;

Is your code entering into loop?

Just add a message after both repeat loops and check…

Yes… As u said it is giving the message, but even that it is giving row wise, it is not displayin once for the entire column.

Thanks,

Divya

I didnt get you.

Can you share your result and what you are expecting with example…

Try to add

REPEAT After exit

and UNTIL Next = 0; at the end of above code and try…

2273.Doc1.docx (100 KB)

Please go through the screen shot. Here when I click the ‘Balance to sell’ in update button it is jus updating for a single item. But I want it to update for all the items showing in the form.

Thanks,

Divya

Thanks Mohana :slight_smile: Addes Repeat ant Until… its working very fine… Thank you…

Hi…

I have another problem on this form. If I click the update button at the bottom to update the values, it is updating the values only fa the items which is visible on the form… I mean if I scroll down I have many more items, but its updating only fa the items which is visible on the form widout scrollin down. Can anyone suggest how I cwn overcome this…

Thanks,

Divya

Just try currform.update.