catch from temporary table,cannot?

julkifli33julkifli33 Member Posts: 1,087
I'm using Table 246 (Requisition Line) with TempRL as temporary variable and RL as not temporary variable
but why I cannot catch if i set TempRL as Temporary table?
if i set as not temporary table, i can catch.....
what do i miss?

My code
TempRL.SETRANGE(TempRL."No.",RL."No.");
TempRL.SETRANGE(TempRL."Variant Code",RL."Variant Code");
IF TempRL.FIND('-') THEN
message('TEST');

Answers

  • hemantOnehemantOne Member Posts: 98
    Hi,

    I think first you need to check Temporary table contain any data or not by using count.Then start to apply any filter.
    Regards,
    Hemant
    They can conquer who believe they can
    .
  • julkifli33julkifli33 Member Posts: 1,087
    hemantOne wrote:
    Hi,

    I think first you need to check Temporary table contain any data or not by using count.Then start to apply any filter.

    if i set temporary = no --> it can be caught
    but if i set temporary = yes --> it cannot be caught
  • julkifli33julkifli33 Member Posts: 1,087
    TempRL --> Requisition Line (Temporary Yes)
    Test --> Requisition Line (Temporary No)
    MESSAGE('Test%1 RL%2',Test.COUNT,TempRL.COUNT);
    

    Test 10 RL 0

    Why is it like this???
  • hemantOnehemantOne Member Posts: 98
    hi,


    First Insert the records in TempRL before applying any filter.
    I don't know what u trying but may be you need --

    TempRL := RL;
    TempRL.Insert;
    Regards,
    Hemant
    They can conquer who believe they can
    .
  • julkifli33julkifli33 Member Posts: 1,087
    My full code is like this
    if the record already in it, it should be modify
    but if not, then it's insert
    For your information , i already done using this code for purchase and sale
    after i copy paste, for requisition is cannot :(
                        TempRL.RESET;
                        TempRL.Quantity := 0;
                        TempRL.SETRANGE(TempRL."Worksheet Template Name",RL."Worksheet Template Name");
                        TempRL.SETRANGE(TempRL."Journal Batch Name",RL."Journal Batch Name");
                        TempRL.SETRANGE(TempRL."Vendor No.",DocNo);
                        TempRL.SETRANGE(TempRL.Type,2);
                        TempRL.SETRANGE(TempRL."No.",RL."No.");
                        TempRL.SETRANGE(TempRL."Variant Code",RL."Variant Code");
                        IF TempRL.FIND('-') THEN
                        BEGIN
                          REPEAT
                            TempRL.GET(TempRL."Worksheet Template Name",TempRL."Journal Batch Name",TempRL."Line No.");
                            TempRL.Quantity := TempRL.Quantity + RL.Quantity;
                            TempRL.MODIFY;
                          UNTIL TempRL.NEXT =0;
                        END
                        ELSE
                        BEGIN
                          TempRL."Worksheet Template Name" := RL."Worksheet Template Name";
                          TempRL."Journal Batch Name" := RL."Journal Batch Name";
                          TempRL."Line No." := RL."Line No.";
                          TempRL.Type := 2;
                          TempRL."No." := RL."No.";
                          TempRL."Variant Code" := RL."Variant Code";
                          TempRL.Quantity := RL.Quantity;
                          TempRL.INSERT;
                        END;
    
  • hemantOnehemantOne Member Posts: 98
    Hi,

    Your code seems correct , debugger may be help you to find if anything wrong....
    Regards,
    Hemant
    They can conquer who believe they can
    .
  • julkifli33julkifli33 Member Posts: 1,087
    hemantOne wrote:
    Hi,

    Your code seems correct , debugger may be help you to find if anything wrong....

    i really confused about this
    how to use debugger??
  • julkifli33julkifli33 Member Posts: 1,087
    i already solved it
    if forgot to insert the vendor no.
    but i setrange it
    now....
                          TempRL."No." := RL."No.";
                          TempRL."Variant Code" := RL."Variant Code";
    [b]                      TempRL."Vendor No." := RL."Vendor No.";[/b]
                          TempRL.Quantity := RL.Quantity;
    

    now it's ok
    thanks :)
Sign In or Register to comment.