Options

Quick Help with C/Side ( easy )

adamEthanadamEthan Member Posts: 104
Hey guys.

Using the Sales Shipment Header + Lines, I'm trying to write something that will show the difference, in days, between the ship date in the header and the planned shipment date in the lines. basically to see if we are shipping on time or not.

in the lines, i did

OnTime := "Sales Shipment Header"."Shipment Date" - "Planned Shipment Date"

I set "OnTime" to be an integer and dropped it in a custom report, in the lines body.

now when i run the report i get a date invalid error. where am i going wrong?

and is there a good C/Side book that i could buy? any help would be greatly appreciated!

-Adam

Comments

  • Options
    lakshmivallurulakshmivalluru Member Posts: 168
    hi,

    If wither of the dates are nto assigned you get the error. Either Sales header shipment date is blank ( 0D) or the salesline planned shipmnet date is blank ( 0D)

    check if they are blank before you calculate.

    clear(OnTime);
    if (SH.shimentdate <> '' ) and (sl.plannedshimentdate <> '') then
    OnTime := SH.shimentdate - l.plannedshimentdate ;
    LR
  • Options
    adamEthanadamEthan Member Posts: 104
    thanks for the reply! i'm going to give it a shot right now!

    also:

    are there any good cside books? :(


    edit:

    ok i pasted the code, and tried to define the variables.. i'm a noob, i'm sorry. i specified in the globals

    sh / record / sales shipment header
    sl / record / sales shipment line

    then i got stuck defining the (sl.shipment <> ) part.

    i'm sorry
  • Options
    jversusjjversusj Member Posts: 489
    adamEthan wrote:
    thanks for the reply! i'm going to give it a shot right now!

    also:

    are there any good cside books? :(


    edit:

    ok i pasted the code, and tried to define the variables.. i'm a noob, i'm sorry. i specified in the globals

    sh / record / sales shipment header
    sl / record / sales shipment line

    then i got stuck defining the (sl.shipment <> ) part.

    i'm sorry
    sl refers to the table (covered by your record global). the part after the . refers to the field. so you'd have to enter something like sl."planned shipment date" <> 0D.
    there are a ton of helpful PDFs on the Navision installation disc, plus the often less than stellar C/side reference guide accessible from within Navision.
    kind of fell into this...
  • Options
    lakshmivallurulakshmivalluru Member Posts: 168
    ok copy paste the following :

    if ("Sales Shipment Header"."Shipment Date" <> 0D) AND
    ("Planned Shipment Date" <> 0D) then
    OnTime := "Sales Shipment Header"."Shipment Date" - "Planned Shipment Date"
    else
    OnTime := 999999;


    lets say 999999 indicating its a a invalid date.
    LR
  • Options
    adamEthanadamEthan Member Posts: 104
    thanks for all the replies.

    I added some totals, and my report is really shaping up!

    Is there any type of "count" function in Navision? Where I could "count" all the "lines" of the report, and "count" how many lines have a positive "OnTime" value?

    And then divide them to come up with a OnTime %?

    =) i really appreciate all your help!

    you guys have made my morning very successful :)
  • Options
    adamEthanadamEthan Member Posts: 104
    bump for help on figuring out counting and applying a %? :)
  • Options
    jversusjjversusj Member Posts: 489
    adamEthan wrote:
    bump for help on figuring out counting and applying a %? :)

    you could use a couple of incrementing integer c/al globals to count things as you find them...

    like:
    if ("Sales Shipment Header"."Shipment Date" <> 0D) AND
    ("Planned Shipment Date" <> 0D) then begin
    OnTime := "Sales Shipment Header"."Shipment Date" - "Planned Shipment Date";
    IF OnTime > 0 THEN
    Counter1 += 1;
    IF OnTime <0 THEN
    Counter2 += 1;
    end else begin
    OnTime := 999999;
    end;

    at the end of the report you can do arithmetic with these integers you've calculated, like

    If (Counter1 + Counter2) <> 0 THEN //just to handle potential divide by zero errors
    "%OnTime" := ROUND(Counter1 / (Counter1 + Counter2),.02) *100;

    you will have to program this to meet your needs, obviously. don't just copy and paste this.
    kind of fell into this...
  • Options
    adamEthanadamEthan Member Posts: 104
    thank you for the insight. i really appreciate it! i'm pretty new to navision and really dont have a programming background.

    I can do some basic things, but things get hairy when i need to start coding. but i'm doing my best! live and learn i suppose.

    thanks so much!

    ~adam
  • Options
    jversusjjversusj Member Posts: 489
    adamEthan wrote:
    thank you for the insight. i really appreciate it! i'm pretty new to navision and really dont have a programming background.

    I can do some basic things, but things get hairy when i need to start coding. but i'm doing my best! live and learn i suppose.

    thanks so much!

    ~adam
    it was the same for me. i got this job in Feb 2004 and had to learn how to program basically on my own without any prior programming experience. i found that good common sense, a little logic, and an understanding of basic table relationships can get you pretty far without doing anything too mind-blowing programming wise! i also found it very helpful to look at existing navision reports that did similar things that i wanted to accomplish and reverse engineer them to do what i needed in my new report.

    i learn new things every day thanks to this forum, so definitely keep coming back to Mibuso if you are serious about learning Nav!
    kind of fell into this...
  • Options
    adamEthanadamEthan Member Posts: 104
    Hey, I'm glad to hear it's not an impossible journey! :)

    I make multi table reports all the time and all sorts of basic things, it's just the code that's killing me. Fortunately Nav will try and point out the error in the code so I can rewrite it until it works out correctly.

    Although having a good understanding of "If Else Begin End Then" statements would definitely help me out. haha.

    Thanks again

    -adam
  • Options
    adamEthanadamEthan Member Posts: 104
    Okay. My absolute last question for the week. :oops:

    I was able to get the counter to work and got the % to work, all in the footer.

    Is there anyway I can transplant that data into the header section? I mean it's perfect data, and I'm super happy, but when i put the fields in the header they came up as blank, T_T
  • Options
    jversusjjversusj Member Posts: 489
    adamEthan wrote:
    Okay. My absolute last question for the week. :oops:

    I was able to get the counter to work and got the % to work, all in the footer.

    Is there anyway I can transplant that data into the header section? I mean it's perfect data, and I'm super happy, but when i put the fields in the header they came up as blank, T_T

    the problem is that the data is not calculated until all of your data processing has been done (ie. at the footer, after the last record was prcessed). The report is created in real time, though, so the header is generated long before you have ever "done the math." you could use some integer data items after your existing data items to create the report sections after you have done all of the processing, but this will entail a lot more programming on your end. you would have to be writing values to temp tables and recalling those during the integer data item output.

    it would be like:
    data item 1
    data item 2
    data item 3
    data item x
    data item y
    Integer (with all section output based on this)

    maybe there is an easier way, but rookie me has not found it!
    kind of fell into this...
  • Options
    adamEthanadamEthan Member Posts: 104
    hey, thanks for the help :) I really appreciate it. Maybe someone will chime in, maybe someone else won't. But either way I've gotten a lot of great help from this thread and hope that someday i'll be able to help someone else out :)
Sign In or Register to comment.