Getting decimal fields from a different IDO and adding them together


The Requirement

Our despatch team are known to mis-ship from time to time, as a result they have to ship-back an order, but they often forget that freight might of been placed onto the order, therefore do not adjust that at the same time. We need to be able to show the despatch user the amount of freight being charged.

I’ve attached this to the on change event of the order number combo box

Unbound Freight Field

Syteline 8 Personalisation – Unbound Freight Field

The Code

Sub PBTI_GetFreight()

ThisForm.Components(“PBTI_EDIT_Freight”).Value = “”

Dim custorder AsLoadCollectionResponseData

custorder = Me.IDOClient.LoadCollection( _

“SLCos”, _

“CoNum, Freight, FreightT”, _

“CoNum = ‘” & ThisForm.Variables(“CoNumVar”).Value & “‘”, _

“”, -1)

 

ThisForm.Components(“PBTI_EDIT_Freight”).SetValue(custorder(0, “Freight”).GetValue(OfDecimal)() + custorder(0, “FreightT”).GetValue(OfDecimal)())

EndSub

 

Thoughts

There are many other ways we could of done this, we could of added a derived field to the IDO, we could of added a secondary IDO to the form, we could of linked via the CoNum property rather than the variable …….. who actually knows which way would of been best, but in this occasion an unbound component being updated on the data change of a combo box seemed fitting.

What I am trying to illustrate here is the process of adding 2 strings (as that is what is returned) together as decimals.

I hope this helps

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.