You are not logged in.
Pages: 1
Just went to alter some layouts and found no variables from the Items fields are being populated at print time. All other field categories seem fine, but {sku} {code} {loc} {title} {total} etc are just printing out as {sku} {code} etc.
Is there a feature that allows this that needs activating?
Last edited by pepsi_max2k (31-07-2014 03:46 pm)
Offline
Those fields can only be used within an Invoice Frame.
If they are in an Invoice Frame, then you need to enable Invoice Printing from Tools>Features.
Offline
Thanks, sorted it now. Just faked a text frame to think it's an invoice frame (or vice versa) :) Bit complicated but at least I can output SKUs on shipping lables now :)
Offline
You can use the {SkuList} field, which will do that.
Offline
Just to avoid another similar thread... I'm trying to use item fields in a script for Print_PackingRow but it's throwing up errors.
I have one for Print_PickingRow which is roughly similar to the example at http://www.aimcosoftware.co.uk/v3help/i … ripts.html (ie. using Item.Quantity, Item.Title etc). But the same for Print_PackingRow doesn't work (presumably because it starts "ByVal Record As RecordStruct" instead of "ByVal Item As ItemStruct"). So how do I access Item fields? It obviously can because the default has them.
Also, how do I use the HTML templates in _resources? I tried renaming one Packing_Item and altering that but it's having no affect on the printout.
inb4 noob :)
Offline
You need Record.Invoice.Items
The templates are a legacy from an earlier version that have been replaced by scripting.
Offline
ok might be being a bit dumb here but...
Record.Invoice.Items.Title
Record.Invoice.Items.SKU
Record.Invoice.Items.Quantity
all giving error not member of System.Array.
Record.Invoice.Items.Item... is the same. What am I doing wrong?
Also, is there a list of available variables somewhere? Might help later on :)
Offline
Items is an array of ItemStruct, so:
Record.Invoice.Items(n).Titleor
For Each Item as ItemStruct in Record.Invoice.Items
x = Item.Title
'etc
NextThere isn't a list of variables because they are all available as auto-complete. We have so few users who do their own coding, that we just haven't written any documentation.
The best way is just to post any queries here, as you have done.
Offline
Mmm still failing. Just gonna paste the code and see what you make of it.
I've tried adding Record.Invoice.Items(0).Title instead of Item.Quantity, and everything else mentioned above, but errors or no errors it just refuses to print anything out at all in the rows; just the header and footer are sorted. Never coded vb.net so don't know where to start with loops and stuff (I assume as it's looping through records anyway, looping through items as well will just give me X by X rows instead of just X rows - unless I can exit the first loop after the first run).
Module Scripting
' Function to alter PickList row formats. THIS WORKS FINE
Function Print_PickingRow(ByVal Item As ItemStruct) As String
' Shorten item titles to remove everything after first dash.
Dim ItemName As String = Item.Title.Substring(0, Item.Title.IndexOf(" - "))
' Format row output using html.
Return String.Format("<td align=center style=""border:0px solid white;width:40px"">{0}</td><td style=""border:0px solid white;width:150px"">{1}</td><td style=""border:0px solid white;width:500px;white-space:nowrap;overflow:hidden;text-overflow:clip;"">{2}</td>", Item.Quantity, Item.SKU, ItemName)
End Function
' Alter Packing Row formats THIS DOESN'T WORK
Function Print_PackingRow(ByVal Record As RecordStruct) As String
' Shorten item titles to remove everything after first dash.
Dim ItemName As String = Item.Title.Substring(0, Item.Title.IndexOf(" - "))
' Format row output using html.
Return String.Format("<td align=center style=""border:0px solid white;width:40px"">{0}</td><td style=""border:0px solid white;width:150px"">{1}</td><td style=""border:0px solid white;width:500px;white-space:nowrap;overflow:hidden;text-overflow:clip;"">{2}</td>", Item.Quantity, Item.SKU, ItemName)
End Function
End Module
Last edited by pepsi_max2k (08-08-2014 06:18 pm)
Offline
Ok finally got somewhere with this. Basically, the below both print out (mostly) the same thing - exception being the Packing List prints a row for each item, whereas picking list prints one row for items with multiple quantities (though, with the same code, maybe it would too).
As you can probably tell, I have no idea what's going on in vb, and have added random variables and returns simply to kill some errors (why can't i just declare a variable in the for loop and have the single return in there? should i have learnt this in java classes at uni? probably :( ).
Module Scripting
' Function to alter PickList row formats.
Function Print_PickingRow(ByVal Item As ItemStruct) As String
' Shorten item titles to remove everything after first dash.
Dim ItemName As String = Item.Title.Substring(0, Item.Title.IndexOf(" - "))
' Format row output using html.
Return String.Format("<td align=center style=""border:0px solid white;width:40px"">{0}</td><td style=""border:0px solid white;width:150px"">{1}</td><td style=""border:0px solid white;width:500px;white-space:nowrap;overflow:hidden;text-overflow:clip;"">{2}</td>", Item.Quantity, Item.SKU, ItemName)
End Function
Function Print_PackingRow(ByVal Record As RecordStruct) As String
Dim ItemName As String = "Hello"
For Each Item As ItemStruct In Record.Invoice.Items
ItemName = Item.Title.Substring(0, Item.Title.IndexOf(" - "))
' Format row output using html.
Return String.Format("<td align=center style=""border:0px solid white;width:40px"">{0}</td><td style=""border:0px solid white;width:150px"">{1}</td><td style=""border:0px solid white;width:500px;white-space:nowrap;overflow:hidden;text-overflow:clip;"">{2}</td>", Item.Quantity, Item.SKU, ItemName)
Next
Return String.Format("<br />")
End Function
End Module
Offline
oh i can declare it in the loop. oh well. return statement still complains. how do i return null? must learn vb must learn vb :(
Offline
Yes, to do this you must learn VB ;-)
Putting the return in the loop will only return the first item of each record, you need to concatenate the text you want to see, then return it at the end. e.g.
'Set the opening TD
Dim RowHtml as String = "<td>"
For Each Item as ItemStruct in Record.Invoice.Items
RowHtml &= Item.Title & "</br>"
Next
'Return titles on each line and close TD
Return RowHtml & "</td>"Also, for ease you can enclose your style statements in single quotes.
Offline
Pages: 1