ContactDownload

Advice and Support Centre

Announcement

Recent posts

Current Status

Price increases 2026

Not commonly downloaded

Latest update for all users

Getting Help With Packing Partner

Registering a user account

#1 31-07-2014 03:44 pm

pepsi_max2k
Member
pepsi_max2k

Items fields not showing up in Layouts?

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

#2 01-08-2014 04:10 pm

Andrew
Admin
Andrew

Re: Items fields not showing up in Layouts?

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

#3 02-08-2014 04:18 pm

pepsi_max2k
Member
pepsi_max2k

Re: Items fields not showing up in Layouts?

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

#4 04-08-2014 09:46 am

Andrew
Admin
Andrew

Re: Items fields not showing up in Layouts?

You can use the {SkuList} field, which will do that.

Offline

#5 08-08-2014 10:39 am

pepsi_max2k
Member
pepsi_max2k

Re: Items fields not showing up in Layouts?

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

#6 08-08-2014 11:48 am

Andrew
Admin
Andrew

Re: Items fields not showing up in Layouts?

You need Record.Invoice.Items

The templates are a legacy from an earlier version that have been replaced by scripting.

Offline

#7 08-08-2014 01:23 pm

pepsi_max2k
Member
pepsi_max2k

Re: Items fields not showing up in Layouts?

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

#8 08-08-2014 03:06 pm

Andrew
Admin
Andrew

Re: Items fields not showing up in Layouts?

Items is an array of ItemStruct, so:

Record.Invoice.Items(n).Title

or

For Each Item as ItemStruct in Record.Invoice.Items
  x = Item.Title
  'etc
Next

There 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

#9 08-08-2014 06:15 pm

pepsi_max2k
Member
pepsi_max2k

Re: Items fields not showing up in Layouts?

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

#10 15-08-2014 05:39 pm

pepsi_max2k
Member
pepsi_max2k

Re: Items fields not showing up in Layouts?

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

#11 15-08-2014 05:42 pm

pepsi_max2k
Member
pepsi_max2k

Re: Items fields not showing up in Layouts?

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

#12 16-08-2014 11:19 am

Andrew
Admin
Andrew

Re: Items fields not showing up in Layouts?

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

Board footer