Hi,
Please help. I am not much coder how to count records and it has to come in sales invoice report.
that means Example:
s. no item qty unit price amout
1 xx 1 100 100
2 yy 1 200 200
3 zz 1 100 100
so i want serial no increment that is 1, 2, 3...... depends up on records
i done some thing like this but i am not getting.
i defined variable count, data type = int
in sales Line trigger On pre dataitem count =0;
on after get record = count=count+1;
when try to save this i am getting error THE RETURN VALUE SHOULD BE USED FOR THIS FUNCTION.
please provide solution how to do this. I am learner in coding . please provide code and solution. Please explain step by step.
regards
lally
0
Comments
or this
The latter is the correct way. When assign values to variables you must use the := operator.
The = operator is used for comparisons and returns true or false.
:^o
http://www.BiloBeauty.com
http://www.autismspeaks.org
TempSalesLine.SETRANGE(Type,SalesHeader.Type);
TempSalesLine.SETRANGE("Document No.",SalesHeader."No.");
Count:=TempSalesLine.COUNT;
http://mibuso.com/blogs/davidmachanick/
Change your variable name as count is a reserved word in NAV.
OnPreDataItem
Ser := 0;
OnAfterGetRecord
Ser := Ser + 1;
Hope this helps
Albert
COUNT is a reserved word in NAV, you can not use it as a variable name.
If you are in the "Sales Line" section, define a variable NoOfLines, and add the code:
that's all you need.
I put u r code in sales line on pre data item and taken a report with 3 records.
what i got every record showing 3 number at begining
that 3 for Ist record
3 for 2nd record
3 for 3 rd record
I dont want like this
what i want
1 for Ist record
2 for 2nd record
3 for 3rd record.................
like this
I tried u r code on after geet record in sales line.
but it is giving same
please provide solution.
thanks in advance.
OR
On pre dataitem. onaftergetrecord
David's post is about COUNT - like your post title says.
It will give you the total amount of lines but this is not apparently what you are looking for.
http://www.BiloBeauty.com
http://www.autismspeaks.org
I done already in the down process same as waht u told now.
I defined variable count, data type = int
in sales invoice Line trigger On pre dataitem count =0;
i put in sales invoice on after get record = count=count+1;
when try to save this i am getting error THE RETURN VALUE SHOULD BE USED FOR THIS FUNCTION.
please provide solution how to do this. I am learner in coding . please provide code and solution. Please explain step by step.
can u explain about that line no code . where to write.
thanks in advance
Have you tried ANY OTHER variable name?
How about myCOUNT
or
Variable name: MyCount (type integer)
onaftergetrecord add
MyCount := Salesline."Line No." / 10000;
that's it. Now make a text box & set the source to MyCount & display it on your report, or whatever you are trying to show it.
http://www.BiloBeauty.com
http://www.autismspeaks.org
i tried what u told .
But it is giving error u have specified unknown variable "lineno"
please provide solution.
thanks and regards.
Pargesoft
In any programming you can't just assume the program will know what you're trying to do. "Similar" is never "the same"
"Sales Invoice Line"."Line No."
or if you are using the Sales Line Table then it would look like
"Sales Line"."Line No."
In fact if you are putting the code on the same dataitem as the field you usally do not have to add the "Sales Invoice Line" or "Sales Line" part. I did that so not to confuse and to make it a bit clearer about where the data is coming from.
Maybe it's a translation thing but I would stop adding please provide solution at the end of the posts, it just doesn't sound nice, at least to me O:)
Other things to consider...
1) using the "Line No." instead of the MyCount := Mycount + 1 method is assuming your no going to do anything freaky with "Line No." in the future.
2)When you count are you just wanting to count the lines of type "Item". You make no provisions for a blank text line or g/l account, etc.
something you might want to think about
http://www.BiloBeauty.com
http://www.autismspeaks.org
Mention the following code in OnAfterGetRecord Trigger
sno := sno + 1;
This code will serve your purpose.
Anirudh
09876157998