Does anyone know how to create a Word Report where I can dynamically create pages based on a user populated field. I want a Box Label where the user enters the number of labels they need. I was thinking to use the Integer table…
Thanks
Does anyone know how to create a Word Report where I can dynamically create pages based on a user populated field. I want a Box Label where the user enters the number of labels they need. I was thinking to use the Integer table…
Thanks
Hi, you don’t specify which version of NAV you’re using but I’m using NAV 2013R2 and I used a dotnet dialog box to capture user input for number of labels with a Brother printer label solution I setup at my company.
Create a dotnet variable that points to: Microsoft.VisualBasic.Interaction.‘Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’
Make sure to change the properties of the RunOnClient option to “YES”.
Then you can use code similar to this:
LabelQty := LabelQtyInputWindow.InputBox(‘Input quantity of labels to print. NB. Cancelling will stop the print’, ‘ENTER LABEL QTY’,’’,100,100);
EVALUATE(Qty,LabelQty);
LabelQty is a text variable because dotnet variable returns text type.
Then you just create a “Qty” integer variable and convert the LABELQTY variable using evaluate.
This was lifted from a case statement where if you cancel then a zero option was used to exit, hence the “NB. Cancelling will stop the print” phrase.
You can then use a loop using the “QTY” variable however many times with whatever code to do what you want to do as far as the word doc goes.
That link will give an explanation of the parameters of InputBox.
HTH,
Richard
Hi Yann,
Word layout reports are basically not very dynamic and you cannot make any formulas or alike.
But as long as you can do all the “logic” in the report, then it should be possible to do. And if you have your “box header” and Integer table (as you write) as the report dataitems, where the integer element is repeated for as many time as the user request it. I think you can find examples on label reports created like that in the standard reports.
If you are printing to a “true label printer”, and prints 100’s of labels everyday, then it could make sense to looking to a more advanced solution, like RichLloyd suggests.
I was able to achieve this using the Word Layout. I used the Integer Table as my first dataitem.
Then on the word document I created a 4 x 6 page, inserted a table in the word doc with only 1 cell. This table is the full size of the page.
I then inserted a repeater in the table which is linked to the Integer dataitem.
The report has a 1 parameter to get the number pages required. I then set a filter to the Number table based on the number of pages required.
It wasn’t easy to do and get it working but once you figure it out, it makes sense.
Thanks
Yann