don't know hot to delete loop record

maya-chanmaya-chan Member Posts: 45
Hi Masters,

I confuse of my problem. Here, a task from user. They need report for transfer shipment. But usually when enter/input for this table they didn't use item no but user search description (by using search description they could get the item no/part no). The problem is, there is 1 record that have multiply input but only have 1 item no/part no (others are comment only), but on report shown 4 part no which is the part no of 1st then loop to 2nd and 3rd line. How I delete or make it not loop for 2nd and 3rd line?

I hope all of you can understand what I mean.
Please and thanks

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    If it is donr through code then you can find
    IF xxx.FINDSET THEN
      REPEAT
      UNTIL xxx.NEXT = 0;
    

    If you need only first record then use
    IF xxx.FINDFIRST THEN
    
  • maya-chanmaya-chan Member Posts: 45
    Thanks for your replying.

    I will try it. I have to modified last report from other consultant, i try if it is could or not (that's the prob)
  • David_SingletonDavid_Singleton Member Posts: 5,479
    The correct solution is to teach your users how to search and filter correctly. You should never think of CODE as a substitute for training. Once you start down this path they will want everything modified to their way of working instead of learning Navision.

    I bet this conversation starte with the users saying "Yeah but in our old system..." That is called the road to hell.
    David Singleton
  • maya-chanmaya-chan Member Posts: 45
    Mr David,

    Yeah you are correct. But, we can't avoid user habit. From the beginning they always search description rather than input part no or item no. Then use other comment on the next line. When I see table Transfer Shipment Line, that I found and realize why it loop. But until now can't solve. 1st Consultant who fix it before has resigned and now i confuse about his code.

    onaftergetrecord()
    PostedDocDim2.SETRANGE("Table ID",DATABASE::"Transfer Shipment Line");
    PostedDocDim2.SETRANGE("Document No.","Transfer Shipment Line"."Document No.");
    PostedDocDim2.SETRANGE("Line No.","Transfer Shipment Line"."Line No.");

    //this part I guess for looping
    vUnitPrice := 0;
    vTotalAmt := 0;

    IF vItem.GET("Transfer Shipment Line"."Item No.") THEN BEGIN
    vUnitPrice := vItem."Unit Price";
    vPartNo := vItem."Search Description";
    // even user input just a comment and no part no, on the report still shown looping and take the 1st part no and on the description there's //show the comment
    END;

    vTotalAmt := vUnitPrice * "Transfer Shipment Line".Quantity;
  • maya-chanmaya-chan Member Posts: 45
    I tried Mohanna code, but I can't change anything on this. When I compile, always shown error

    Error while validating RDL content:
    The value expression for textbox 'Transfer_Shipment_Line_Item_No_Caption' refers to field 'Transfer_Shipment_Line_Item_No_Caption'. Report item expression can only refer to field with in the current data set scoop on, if inside an aggregate, the specified data set scoop.

    anyone know what the error mean?
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    maya-chan wrote:
    I tried Mohanna code, but I can't change anything on this. When I compile, always shown error

    Error while validating RDL content:
    The value expression for textbox 'Transfer_Shipment_Line_Item_No_Caption' refers to field 'Transfer_Shipment_Line_Item_No_Caption'. Report item expression can only refer to field with in the current data set scoop on, if inside an aggregate, the specified data set scoop.

    anyone know what the error mean?

    Did you delete any field in classic sections and forget to delete in rdlc data (related to RTC report)?

    Error message is completely different..not related to code which I suggested..
  • maya-chanmaya-chan Member Posts: 45
    Did you delete any field in classic sections and forget to delete in rdlc data (related to RTC report)?

    Error message is completely different..not related to code which I suggested..[/quote]


    No. I didn't do anything with the table (deleted field or anything). Only with report. I see that code and wanna modify, but can't even just put enter. When compile shown that error.
  • maya-chanmaya-chan Member Posts: 45
    Oke, just assume the person who 1st modify this report do deleted field. So, where should I must go to check weather it has been delete or not on RDLC data?
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    maya-chan wrote:
    No. I didn't do anything with the table (deleted field or anything). Only with report. I see that code and wanna modify, but can't even just put enter. When compile shown that error.
    I didnt mean table..

    I mean in sections of report..

    If you didnt then the problem should be exising before also..
  • maya-chanmaya-chan Member Posts: 45
    I am not sure about it. It could be, because I get it from other consultant before. If we have deleted like u said, what should I do then?
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    You have to identify the field and add it in classic sections of report or delete the field in rdlc report..
  • maya-chanmaya-chan Member Posts: 45
    Oke I try.

    Thanks
  • maya-chanmaya-chan Member Posts: 45
    I have restore the database with the last object before modify that report.
    It's same, I can't modify with same error. But I can run it same like before the looping show.
    I don't know how to go to RDLC report and delete what mention on the error message. Can you explain the step for me?

    Sorry if it is bother you

    Thanks
  • David_SingletonDavid_Singleton Member Posts: 5,479
    maya-chan wrote:
    Mr David,

    Yeah you are correct. But, we can't avoid user habit.

    Yes you can, its called training.

    It's their job that they are paid to do.
    David Singleton
  • maya-chanmaya-chan Member Posts: 45
    Hmm ok, it could be my homework to them. They want create some comments on this report that's why.
    But now I still stuck with can't modify the code report.

    Please anyone can help....
  • StLiStLi Member Posts: 83
    the error you got is because the rdlc layout (the report design for the RTC client) should display a control that has been deleted on the classic layout (section designer).


    according to the error message a control with the property DataSetFieldName set to "Transfer_Shipment_Line_Item_No_Caption" is missing. Because NAV generates these DataSetFieldNames based on the DataItem Name, field caption and the fact if its a title or not. I can tell that probably the Title of the "Item No."-column has been deleted.

    If your customer doesn't use RTC i'd think about deleting the rdlc layout because you won't be able to delete any control on the classic section designer anymore if you don't adjust the rdlc layout every time. Even though it would be absolutely unnecessary if noone is using RTC on that database anyway. I must warn you though that it is a lot of work to recreate it the way it looked before. And i won't take any responsibility. So better make a backup ;-)

    There are two other ways to fix the problem:
    a) re-insert the control for the "Item No."-title back into the classic design and set its DataSetFieldName property to "Transfer_Shipment_Line_Item_No_Caption" (it's the last property in the property window).

    b) go into the rdlc layout designer. Find the field that is supposed to print this title and delete the value of that field. (or adjust the layout so you can delete the whole field).


    Back to your opening question: it opens up the question if you are concerned about the rtc layout or the classic layout. on the rtc, there could be just an issue with some properties... on the classic: i'd work with the CurrReport.SHOWOUTPUT(Boolean) command. A Report that is made for printing purposes should never edit the data its Processing in my opinion.

    but just for a guess: try this code here instead of skipping or editing (this should allow you to keep the comment lines printed ;-) (i colored the line i edited from your code to red)

    onaftergetrecord()
    PostedDocDim2.SETRANGE("Table ID",DATABASE::"Transfer Shipment Line");
    PostedDocDim2.SETRANGE("Document No.","Transfer Shipment Line"."Document No.");
    PostedDocDim2.SETRANGE("Line No.","Transfer Shipment Line"."Line No.");

    //this part I guess for looping
    vUnitPrice := 0;
    vTotalAmt := 0;
    vPartNo := '';

    IF vItem.GET("Transfer Shipment Line"."Item No.") THEN BEGIN
    vUnitPrice := vItem."Unit Price";
    vPartNo := vItem."Search Description";
    // even user input just a comment and no part no, on the report still shown looping and take the 1st part no and on the description there's //show the comment
    END;

    vTotalAmt := vUnitPrice * "Transfer Shipment Line".Quantity;
  • maya-chanmaya-chan Member Posts: 45
    Dear Masters,

    It's really help me. I will try this. 1st sure with the rdl data that missing. I hope I can find out it fast.
    Once again, thanks guys :)
  • maya-chanmaya-chan Member Posts: 45
    I have re-inserted the control and set DataSetFieldName into Transfer_Shipment_Line_Item_No_Caption. But still same error. Did I do something wrong with the control?
  • maya-chanmaya-chan Member Posts: 45
    Oke, it's solved for the RDL prob :)
    Trying next step.
  • maya-chanmaya-chan Member Posts: 45
    OK,

    The Part No show blank but for unit Price & Total Amount still show 0. How do I convert decimal to string? I try format, but it doesn't work
  • maya-chanmaya-chan Member Posts: 45
    I got advice to split the report being 2 section.
    1 with full data, and the other only descriptions. But I don't know hoe to do it.
    I am newbie (sorry). Could anyone help me step by step, please???
  • maya-chanmaya-chan Member Posts: 45
    Problem solved with split section and coding from mohana.
    Thx all :)
Sign In or Register to comment.