I have added a new section to Report 206, Sales Invoice Header,Header.
In this header I added a text box... I want to be able to view the
"No. Series Line"."Last No. Used" + 1.
so what I have done:
Global Variables:
NoSeriesLine of type record to the No. Series Line table
NewString of type Code
In the Sales Invoice Header, Header OnPreSection I have written:
NoSeriesLine.GET("Sales Invoice Header"."No. Series");
In the Sales Invoice Header, OnAfterGetRecord I have written:
NewString := INCSTR(NoSeriesLine."Last No. Used");
I added a text box with sourceExpr of NewString.
I get a message:
The No. Series Line does not exist
Identification fields + values:
Series Code := 'S-INV+'
Line No. = '0'
what am I missing?
0
Comments
your GET statement is incorrect.
the primary key for the "no. Series Line" table is
In this table you can setup multiple No.s for the same "No. Series" so you have to identify which one you wish to use.
As This is not held on the "Sales Header" so you will have to make some kind of rule to specify which you require.
i.e. ALWAYS use the last no. series line in which case you could then use
FIND('+');
I go to Sales and receivables...Invoices and click on the Posting No. Series. The Last No. Used is the one I want +1.
If I do:
IF NoSeriesLine.FIND('+') THEN
NewString := INCSTR(NoSeriesLine."Last No. Used");
the same message comes up.
I don't know where to even find where Line No. is...
any suggestions?
As "Dean Axon" mentrioned, if you look into the No. Series Line table, the key is "Series Code,Line No." so you either SETRANGE to one of them and perform a find to get ther coresponding records, or you perform a GET with all the key fields provided to the function. Meaning: -or- :whistle:
Arhontis
https://forum.mibuso.com/search
However, it doesn't show the last no used... in fact, nothing shows up.
thanks for trying
Why do you enable the debugger and place a break point to your code and see where it goes, or do a: after your code to see the calculated values.
:roll:
Arhontis
https://forum.mibuso.com/search
the first one:
NoSeriesLine.SETRANGE("Series Code","Sales Header"."No. Series");
NoSeriesLine.FIND('+');
NewString := INCSTR(NoSeriesLine."Last No. Used");
This takes the last record from the No. Series Line table and adds 1 to it. However, it is not choosing the correct record. It needs to match with the Posting No. Series chosen.
The second one:
NoSeriesLine.GET("Sales Invoice Header"."No. Series",10000);
NewString := INCSTR(NoSeriesLine."Last No. Used");
Nothing shows up here.
I will try the messages that you told me.
I appreciate all your help... I have spent all day trying to do this... and It won't get done..
NoSeriesLine.SETRANGE("Series Code","Sales Header"."Posting No. Series");
NoSeriesLine.FIND('+');
NewString := INCSTR(NoSeriesLine."Last No. Used");
Arhontis
https://forum.mibuso.com/search
No. Series Line table... still not the correct record.
Any other suggestions?
the code that Arhontis gave you should work fine :?:
I tested this :
I suppose the next question is "What trigger are you placing this code in ?"
Regards,
Dean
Let me remind to demi that the numbers in No. Series Line table get increased by the "increment-by No." field that might be different from 1 in the INCSTR case. So he could do "increment-by No." times the INCSTR of the NewString to get a more proper number.
So, the code sould look a bit more like:
First of all I would never predict a posting number on a pre-posted document, I guess everybody agrees to that, since there is not number reservations [-o< .
BTW thanks for the assistance Dean.
Arhontis
https://forum.mibuso.com/search
It works just fine...