Thanks friend!
After some tweaking, this is the final code which seems to work without any errors (For anybody else who wants to use it):
Private Sub edvOrderHed_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvOrderHed.EpiViewNotification
'// ** Argument Properties and Uses **
'// view.dataView(args.Row)("[FieldName]")
'// args.Row, args.Column, args.Sender, args.NotifyType
'// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
If (args.NotifyType = EpiTransaction.NotifyType.Initialize) Then
txtEpiCustom4.text = ""
If (args.Row > -1) AndAlso (view.dataView(args.Row)("BTAddressList").Length > 1) Then
Dim strAddress(6) As string
strAddress = view.dataView(args.Row)("BTAddressList").Split("~")
txtEpiCustom4.text = strAddress(0) + vbCrLf + strAddress(1) + vbCrLf + strAddress(2) + vbCrLf + strAddress(3) + vbCrLf + strAddress(4) + vbCrLf + strAddress(5)
End If
End If
End Sub
After some tweaking, this is the final code which seems to work without any errors (For anybody else who wants to use it):
Private Sub edvOrderHed_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvOrderHed.EpiViewNotification
'// ** Argument Properties and Uses **
'// view.dataView(args.Row)("[FieldName]")
'// args.Row, args.Column, args.Sender, args.NotifyType
'// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
If (args.NotifyType = EpiTransaction.NotifyType.Initialize) Then
txtEpiCustom4.text = ""
If (args.Row > -1) AndAlso (view.dataView(args.Row)("BTAddressList").Length > 1) Then
Dim strAddress(6) As string
strAddress = view.dataView(args.Row)("BTAddressList").Split("~")
txtEpiCustom4.text = strAddress(0) + vbCrLf + strAddress(1) + vbCrLf + strAddress(2) + vbCrLf + strAddress(3) + vbCrLf + strAddress(4) + vbCrLf + strAddress(5)
End If
End If
End Sub
--- In vantage@yahoogroups.com, "bw2868bond" <bwalker@...> wrote:
>
> A little more code always makes it work better ;)
>
> Try altering your code to:
>
> If (args.NotifyType = EpiTransaction.NotifyType.Initialize) Then
> txtEpiCustom4.text = ""
> If (args.Row > -1) AndAlso (view.dataView(args.Row)("BTAddressList").Length > 6) Then
>
> You may have to play with the value of the BTAddressList length....
>
> --- In vantage@yahoogroups.com, "Ian" <ianwhardy@> wrote:
> >
> > Ah, slight problem. When the clear button is pressed, It doesn't remove the data from that field, and the following error occurs if you click on the new button while a record is already populated:
> >
> > "Index was outside the bounds of the array."
> >
> > I'm assuming I would need to call the clear button onto txtEpiCustom4?
> >
> >
> >
> > --- In vantage@yahoogroups.com, "Ian" <ianwhardy@> wrote:
> > >
> > > Works fantastic! Thanks for the help
> > >
> > > --- In vantage@yahoogroups.com, "bw2868bond" <bwalker@> wrote:
> > > >
> > > > Use the Form Event Wizard to create the code for EpiViewNotification on the OrderHed View.
> > > >
> > > > In the script editor use this:
> > > >
> > > > Private Sub edvOrderHed_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvOrderHed.EpiViewNotification
> > > > '// ** Argument Properties and Uses **
> > > > '// view.dataView(args.Row)("[FieldName]")
> > > > '// args.Row, args.Column, args.Sender, args.NotifyType
> > > > '// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
> > > > If (args.NotifyType = EpiTransaction.NotifyType.Initialize) Then
> > > > If (args.Row > -1) Then
> > > > Dim strAddress(6) As string
> > > > strAddress = view.dataView(args.Row)("BTAddressList").Split("~")
> > > > txtEpiCustom4.text = strAddress(0) + vbCrLf + strAddress(1) + vbCrLf + strAddress(2) + vbCrLf + strAddress(3) + vbCrLf + strAddress(4) + vbCrLf + strAddress(5)
> > > > End If
> > > > End If
> > > > End Sub
> > > >
> > > > --- In vantage@yahoogroups.com, "Ian" <ianwhardy@> wrote:
> > > > >
> > > > > Afternoon All,
> > > > >
> > > > > I have been able to populate the field with the broken down address using the following code:
> > > > >
> > > > > Dim OrderHed As EpiDataView = CType(oTrans.EpiDataViews("OrderHed"), EpiDataView)
> > > > > Dim BTAddressList As String = OrderHed.dataView(OrderHed.Row)("BTAddressList")
> > > > > Dim strAddress(6) As string
> > > > > strAddress = BTAddressList.Split("~")
> > > > >
> > > > >
> > > > > txtEpiCustom4.text = strAddress(0) + vbCrLf + strAddress(1) + vbCrLf + strAddress(2) + vbCrLf + strAddress(3) + vbCrLf + strAddress(4) + vbCrLf + strAddress(5)
> > > > >
> > > > >
> > > > >
> > > > > However, I can't seem to get it to load on when a sales order is loaded into Order Entry.
> > > > >
> > > > > I'm assuming I use the Form Event Wizard, but can't seem to locate the correct event to trigger the change.
> > > > >
> > > > > If anybody could point me in the right direction, it would be appreciated.
> > > > >
> > > > > Thanks and regards
> > > > >
> > > > > --- In vantage@yahoogroups.com, "Ian" <ianwhardy@> wrote:
> > > > > >
> > > > > > ah ok. So just to confirm, how would I get this into the textbox? (I'm a bit of an amateur when it comes to coding...)
> > > > > >
> > > > > > Thanks for this
> > > > > >
> > > > > > --- In vantage@yahoogroups.com, "bw2868bond" <bwalker@> wrote:
> > > > > > >
> > > > > > > Shooting from the hip:
> > > > > > >
> > > > > > > Dim strAddress(6) As string
> > > > > > >
> > > > > > > strAddress = OrderHed.BTAddressList.Split("~")
> > > > > > >
> > > > > > > then the various parts of the list would be
> > > > > > >
> > > > > > > strAddress(0)
> > > > > > > strAddress(1)
> > > > > > > strAddress(2)
> > > > > > > strAddress(3)
> > > > > > > strAddress(4)
> > > > > > > strAddress(5)
> > > > > > >
> > > > > > >
> > > > > > > --- In vantage@yahoogroups.com, "Ian" <ianwhardy@> wrote:
> > > > > > > >
> > > > > > > > Hi All,
> > > > > > > >
> > > > > > > > I have done a small customzation where I have added the Bill to address onto the Sales Order Entry; Summary tab, however using OrderHed.BTAddressList makes the address come out like so:
> > > > > > > >
> > > > > > > > CompanyName~Madeup Street~Madeup Town~Madeup State~PostCode~United States
> > > > > > > >
> > > > > > > > Is there a small code for changing the above to a "proper" address?:
> > > > > > > >
> > > > > > > > CompanyName
> > > > > > > > Madeup Street
> > > > > > > > Madeup Town
> > > > > > > > Madeup State
> > > > > > > > PostCode
> > > > > > > > United States
> > > > > > > >
> > > > > > > >
> > > > > > > > Any help will be appreciated.
> > > > > > > >
> > > > > > > > Thanks.
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>