Options

Problem with setselectionfilter

tiagofrancistiagofrancis Member Posts: 48
Hi folks...

I'm want to execute a process by pressing a button in a form that executes a codeunit and pass it only the records that i've selected on the form...

It gives an error such like this...

"Purchase Price ID '0' does not exist"

heres the code



g_recIntEBPrices.RESET;

CurrForm.SETSELECTIONFILTER(g_recIntEBPrices);
IF g_recIntEBPrices.FINDSET THEN
REPEAT
IF g_cduPriceStd.RUN(g_recIntEBPrices) THEN BEGIN
l_recIntPurchPrice.Process := l_recIntPurchPrice.Process::Processed;
l_recIntPurchPrice.MODIFY();
END ELSE BEGIN
l_recIntPurchPrice.Process := l_recIntPurchPrice.Process::Suspended;
l_recIntPurchPrice.MODIFY();
END;
//l_recIntPurchPrice.MODIFY();
COMMIT;
UNTIL g_recIntEBPrices.NEXT = 0;

Comments

  • Options
    garakgarak Member Posts: 3,263
    do you have debug your source?

    Your loop go through the variable g_recIntEBPrices, but you modify the l_recIntPurchPrice <- whats the value?
    Do you make it right, it works too!
  • Options
    sabzamsabzam Member Posts: 1,149
    I am getting the same issue and can't find an answer yet.
  • Options
    kinekine Member Posts: 12,562
    garak wrote:
    do you have debug your source?

    Your loop go through the variable g_recIntEBPrices, but you modify the l_recIntPurchPrice <- whats the value?

    Garak describe it. Where is the l_recIntPurchPrice variable filled in? It is local, it is modified, but nowhere assigned...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    garakgarak Member Posts: 3,263
    so an old post ......
    Do you make it right, it works too!
  • Options
    pietwiersmapietwiersma Member Posts: 1
    You are using a global variable in the SETSELECTIONFILTER.
    Please try to make it a local.
Sign In or Register to comment.