how to read all lines

nvermanverma Member Posts: 396
Hello,

I am working on a report that shows a list of items and the number of quantity of that particular item that we have left in our warehouse. If it Quantiy is more than 0, then I need to output the location code, bin code, quantity and unit of measure code.
CLEAR (BinContent."Location Code")
CLEAR (BinContent."Unit of Measure code Code")
CLEAR (BinContent."Bin Code")
CLEAR (BinContent.Quantity)
If Qauntity <=0 THEN
CurrReport.SHOWOUTPUT(false) 
ELSE
BinContent.SETCURRENTKEY("Item No.");
BinContent.SETRANGE("Item No.", Item."No."); 
if BinContent.FINDSET then
repeat

unti BinContent.next =0;

This code works perfectly if there is only one Location code in BinContent. However, there are times, when an item can be stored in two different location and can have two different bins. If thats the case then I need to show both of the locations in the report. How can i tell the system to write every single location. I know findset will find all of them but i am just not sure how to write every single line. Currently it only writes the last line.

My 2nd issue: there are times when we do an item in the warehouse so quantity is more than 0, but we dont have the location code for the item (we dont know where the item is stored currently in the warehouse). If thats the case, i want that item to get skipped.
I tried this.
If BinContent."Location Code" ='' THEN
CurrReport.skip;

that didnt work though.

Answers

  • jspoppjspopp Member Posts: 54
    hi, where are you putting this code snippet?
  • nvermanverma Member Posts: 396
    its put in the body section of the report and on presection trigger
  • jspoppjspopp Member Posts: 54
    Hi, I wouldn't put the code there. Try to limit your coding in the sections area of your reports. Try putting your code in the OnAfterGetRecord trigger instead. Use your debugger to step through a small sample and you should be able to solve your issue.
  • nvermanverma Member Posts: 396
    umm...OK.. I will put it in on after get record but my 2 issues still remain.

    1) how do i read all the lines from findset and write them to my report because currently it only writes the last line.

    2) if the location code is empty i want it to skip the record becuase currently it throws and error.
  • jspoppjspopp Member Posts: 54
    what do you have set up as your DataItem and Name for your report?
  • nvermanverma Member Posts: 396
    dataitem :- item
    report:- item turnover
  • SavatageSavatage Member Posts: 7,142
    If you only have 1 dataitem why not use DataItemTableView property of the report to filter out things you are sure you don't want to see.

    Location code <>''
    Qty > 0
    etc..
  • nvermanverma Member Posts: 396
    Item is my main dataitem but I am getting my location code, unit of measure code, etc from a different table. so I cant just filter on item dataitem and report does lot of other things so i cant set a filter on the main daitem itself.
  • DenSterDenSter Member Posts: 8,305
    nverma wrote:
    its put in the body section of the report and on presection trigger
    ](*,) ](*,)
  • nvermanverma Member Posts: 396
    @ Den - hahahah..i realized my mistake...my bad

    I figured it out. Its was as simple as creating the Bin content dataitem under the item dataitem....that took care of most of my issues.

    Thanks guyz
  • jspoppjspopp Member Posts: 54
    I knew you would figure it out during my lunch hour - congrats!
  • nvermanverma Member Posts: 396
    I have a quick question. Is there a way to find out if the FINDSET returns true (finds stuff) or false (doesnt find anything). Like I have this case, where the Quantity is more than 0, however, in the warehouse we cant find the location (bin) of this item. The findset is used to read all the bin locations and output them in the report.

    Therefore, If the quantity is more than 0, and the bin is empty...i want it to return false so i can display an appropriate error message. so I created a body with a label and i am trying to use showoutput true or false based on this condition if findset returns true or false.

    whats the code to see if its returns true or false??? Is it as simple as

    This code is situated in the body section of the report.
    if Quanity > 0 THEN
    if "Bin Content".FINDSET = true THEN
    CurrReport.SHOWOUTPUT = FALSE
  • DenSterDenSter Member Posts: 8,305
    If you have a dataitem for Bin Content you don't need to program anything, it only displays stuff when there is stuff available.

    For your question on syntax you will need to use the C/SIDE Reference Guide. Click on the Help menu and click C/SIDE Reference Guide. You can find all C/AL keywords in there, and it specifies the parameters and return values for all of them.
  • SavatageSavatage Member Posts: 7,142
    nverma wrote:
    where the Quantity is more than 0, however, in the warehouse we cant find the location (bin) of this item.

    Can you explain when you say "can't find". Should all items have a bin in your company? If so, filling that value in and preventing future new item entry errors should be something you need to look at also.

    For example on insert of the item table you can force Blocked to be true.
    On validate of the blocked field you can use TESTFIELD to check all the fields you deem mandatory. If one fails the user will be unable to unblock the item until the problem has been corrected and therefore can't be used in the system causing havoc.
  • nvermanverma Member Posts: 396
    Most of the items in the warehouse have a bin where the item is stored, so whenever they need to find the item, it could easily be located. However, for some weird reason some of the items dont have a bin (location) even thought in the database we can see that we have a particular item. If the quantity of the item is more than 0, it mean we have the items in the warehouse, but we dont know which location it is situated in. Thus, we need to display a message saying: Location could not be found. It has been take care of now, but we still have to display this mesasge for the items that is missing the bin location. Thats why if the findset doesnt find anything even thought the quantity is more than 0, we need to display some sort of message to alert the user that we could not locate the bin of this item.
Sign In or Register to comment.