Accessing Lines on a Sales Order

Discussions relating to breakout scripting, .NET and COM programming with Jiwa objects.

Accessing Lines on a Sales Order

Postby aegean66 » Fri Aug 21, 2015 11:01 am

Hi there,

I've looked on this forum and cannot find an answer.

I just want to be able to loop through the lines of a sales order, and action depending on values on any line

I'm no vba expert, but I have worked out how to say show a msgbox when conditions are met for a sales order, but not for the lines on a sales order.

Can someone help me out with the syntax for that?

Many thanks,
Damon.
aegean66
Occasional Contributor
Occasional Contributor
 
Posts: 36
Joined: Wed Mar 02, 2011 2:26 pm
Location: Usa
Topics Solved: 2

Re: Accessing Lines on a Sales Order

Postby Scott.Pearce » Fri Aug 21, 2015 12:00 pm

You could use a For loop:

https://msdn.microsoft.com/en-us/library/5z06z1kb.aspx

or you could use a For Each loop:

https://msdn.microsoft.com/en-us/library/5ebk1751.aspx

For our sales order object specifically you could use something like:

Code: Select all
For Each existingSalesOrderLine As JiwaSales.SalesOrder.SalesOrderLine In mySalesOrderObject
   If existingSalesOrderLine.PartNo = "Fred" Then
      Msgbox("Sales order line no. " + existingSalesOrderLine.ItemNo + " has a part no. of '" + existingSalesOrderLine.PartNo + "'.")
   End If
Next
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Accessing Lines on a Sales Order

Postby aegean66 » Fri Aug 21, 2015 1:20 pm

Thanks for the reply.

I'm just experimenting with the Form Loaded event with this code, and I get the following error?

Image
aegean66
Occasional Contributor
Occasional Contributor
 
Posts: 36
Joined: Wed Mar 02, 2011 2:26 pm
Location: Usa
Topics Solved: 2

Re: Accessing Lines on a Sales Order

Postby Mike.Sheen » Fri Aug 21, 2015 1:39 pm

aegean66 wrote:Thanks for the reply.

I'm just experimenting with the Form Loaded event with this code, and I get the following error?

Image


Your image:
Image

For some reason does not display, but when I go to the dropbox it is linked to I see the image:
screenshot.jpg


Now that we can see the image, it is apparent you are using version 6 of Jiwa, not version 7. The guidance Scott gave you was for version 7 as that is where you posted this thread.

I'm moving this thread to the version 6 forums, where it will be dealt with there.

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Accessing Lines on a Sales Order

Postby aegean66 » Tue Aug 25, 2015 9:44 am

So how can I expose the lines on a sales order in JIWA 6, so that I can, for example, send a msgbox to the screen if certain values appear on a line.

cheers,
Damon
aegean66
Occasional Contributor
Occasional Contributor
 
Posts: 36
Joined: Wed Mar 02, 2011 2:26 pm
Location: Usa
Topics Solved: 2

Re: Accessing Lines on a Sales Order

Postby Scott.Pearce » Tue Aug 25, 2015 10:01 am

Off the top of my head the lines can be accessed through SalesOrderObject.SalesOrderLines. Do note, however, that the collection may not be initialised until after the form loaded breakout is fired.

There is also some developer documentation at "C:\Program Files\Jiwa Financials\Jiwa\Help\Developer Documentation\Jiwa Sales Orders.chm" which you might find helpful.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Accessing Lines on a Sales Order

Postby aegean66 » Thu Sep 10, 2015 8:45 pm

Just in case anyone is wondering. This is how to go through each line on a sales order and test something.

For Each SalesOrderLineObject In SalesOrderObject.SalesOrderLines
If SalesOrderLineObject.ItemPrice < SalesOrderObject.Lcost Then
Msgbox ("Sell price is less than cost")
Else
End If
Next
aegean66
Occasional Contributor
Occasional Contributor
 
Posts: 36
Joined: Wed Mar 02, 2011 2:26 pm
Location: Usa
Topics Solved: 2


Return to Technical / Programming

Who is online

Users browsing this forum: No registered users and 5 guests

cron