Help & Support
Contents
Display Legacy Contents

Search:

Home > Impact Suite > How-To Examples > Copy one field to another

Copy one field to another

You can create a scripted button in the designer to copy the contents of one field to another or multiple fields to multiple fields. First you need to open the data-entry form in the designer by clicking on the DESIGN button on the top toolbar

 

        

 

 

Explain

 Follow these steps below to add the scripted button from the designer.

  1. Click on the BUTTONS icon on the top toolbar

  2. Drag the "Button [Run Script]" from the toolbox on the left onto your form.

  3. In the lower right corner click on the '...' ellipse button next to the ACTCode property
    This will open the 'Code Editor" window as shown above.

  4. Copy the example script from below into this editor.
    Remember to change the source and destination field names which are in bold below.

  5. Click on the SAVE button to close the 'Code Editor'

  6. Click on the SAVE icon then close the designer.

Use this script to copy one field in the custom table to another field in the custom table
'---------------------------------------------------------------------------------------------
' START SCRIPT 
' Get the value from the source field 
Dim val as object = Durkin.Common.Classes.CustomSubEntity.GetFieldDescriptorByANYString("ChangeToSourceFieldName", SubEntityForm.getEntityManager).getValue(SubEntityItem)


' Replace this value into field the destination field
Durkin.Common.Classes.CustomSubEntity.GetFieldDescriptorByANYString("ChangeToDestinationFieldName", SubEntityForm.getEntityManager).SetValue(SubEntityItem,val)


' Refresh the UI ( User Interface) to update the controls on the screen
SubEntityForm.RefreshUI()


' END SCRIPT 
'---------------------------------------------------------------------------------------------


Use this script to copy one field in the CONTACT table to another field in the custom table
'---------------------------------------------------------------------------------------------
' START SCRIPT - CONTACT
' Get the value from the CONTACT attached to the curren record 
Dim val as object = Durkin.Common.Classes.Contacts.GetContactFieldDescriptorByANY("ChangeToSourceFieldName", Me.HostFramework).GetValue(SubEntityItem.GetContacts(nothing)(0))


' Replace this value into field the destination field
Durkin.Common.Classes.CustomSubEntity.GetFieldDescriptorByANYString("ChangeToDestinationFieldName", SubEntityForm.getEntityManager).SetValue(SubEntityItem,val)

' Refresh the UI ( User Interface) to update the controls on the screen
SubEntityForm.RefreshUI()

' END SCRIPT - CONTACT
'---------------------------------------------------------------------------------------------

Notes- Copy Field, copy data, copy column

See also



Properties
Article ID:
copy_one_field_to_another
Views: 352
Created By: jimdurkin
Modified By: [Modified By]
Created Date: 3/24/2014 12:31 PM
Last Modified: 3/24/2014 1:55 PM
Actions
Print This Article
Bookmark
Email This Article
Previous Article
Next Article