how can I put Variant Picture of the Item....

ali_khodrali_khodr Member Posts: 4
:oops:

Hello Developers and Consultants.
I am designing report for Sales Order.
However it requires to put Picture of Item in Sales Line.
This is simple.
But the difficulty is how can I put Variant Picture of the Item if there is already any one.
I mean that I want to display picture of Item in case no Variant Picture.
Otherwise , I want to show the Variant Picture.

I tried all ways , I am beginner in Reporting.
and please explain to me how I use Grouping or Filtering to solve my problem.
Or is there any simple way ? !

Thanks in advance, hopefully that I find a smart consultant or developer who answered me.

Good Luck

Comments

  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'General Chat' forum to 'NAV/Navision Classic Client' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • jupjup Member Posts: 7
    Hi,
    if I understood well your problem, you want to:

    a. IF Variant Item Picture is available -> use it
    b. IF Variant Item Picture is not available -> use Item Picture.

    Is it correct? If so, I think you should add some code like the following in the OnAfterGetRecord trigger of the Sales Line (that is supposed to be called SalesLine):
    lVariantItemHASVALUE := FALSE; // Boolean local var
    
    IF SalesLine.Type = SalesLine.Type::Item THEN
    BEGIN
      // lRecItem = Record Item local var
      IF lRecItem.get(SalesLine."Variant Code") THEN // Try to get the Variant Item
      BEGIN
        lRecItem.CALCFIELDS(Picture);
        lVariantItemHASVALUE := lRecItem.Picture.HASVALUE; // Check if a picture of the Variant Item is available
      END;
    
      IF NOT lVariantItemHASVALUE THEN // No Variant Item or no Picture for that is available
      BEGIN
        lRecItem.get(SalesLine."No."); // Use the Item Picture
        lRecItem.CALCFIELDS(Picture);
      END;
    END;
    

    Those lines are not tested, but I hope that should help..
    -- Jup --
  • alok_kulalok_kul Member Posts: 8
    Hi,
    if I understood well your requirment is like:

    a. IF Variant Item Picture is available -> use it
    b. IF Variant Item Picture is not available -> use Item Picture.

    If it is correct then i think you should add some code like the following in the 'OnAfterGetRecord' trigger of the Sales Line Form.

    As per my knowledge there is no picture facility available for Item variant, so first you need to add a new field called 'Picture' in Item Variant Table.

    VariantPicture:=FALSE;//Variable as a boolen type

    IF Type=Type::Item THEN BEGIN
    ItemVariant.RESET;//ItemVariant is record variable for Item variant Table
    ItemVariant.SETRANGE(ItemVariant."Item No.","No.");
    ItemVariant.SETRANGE(ItemVariant.Code,"Variant Code");
    IF ItemVariant.FINDFIRST THEN BEGIN
    ItemVariant.CALCFIELDS(ItemVariant.Picture);
    IF ItemVariant.Picture.HASVALUE THEN BEGIN
    VariantPicture:=TRUE;
    Picture:=ItemVariant.Picture;
    END;
    END;
    IF VariantPicture=FALSE THEN BEGIN
    IF Item_Local.GET("No.") THEN;//Item_Local is record variable for Item table
    Item_Local.CALCFIELDS(Item_Local.Picture);
    Picture:=Item_Local.Picture;
    END;
    END;

    Also if you want item or item variant picture at time of insertion , please add sane code on 'OnAfterValidate' trigger for No. and Variant code in sales line form.

    Please try above and if you have any quarry please let me know.
Sign In or Register to comment.