Copy Field from One Form to Another


I understand how to use the GetData and SetData commands in an EasyFunction to copy data from one field to another field on the same form, but how do I get data from another form?  What I'm looking to do is copy ORDR.DocDueDate to ODLN.DocDueDate.  I have a SQL query that can find the value that I need but if there is a similar function to Get/Set Data available I think I would prefer to go that route.  The process is that the user selects the Copy To --> Delivery from within the sales order, but in order for the rule to be fool proof should probably allow for using the Copy From --> Sales Order on the delivery.  Thanks in advance for the help.


EDIT: I think I'm on the right track in using SQLQuery to write the value to the dictionary and then SetData to write it to the ODLN.DocDueDate field, but I'm getting an error on the field I'm using to join my tables in the query.  The query works fine by itself, but within the rule, gets this error...


     Error in EasyFunction rule: "[rule name]"


     Error in command "SQLQuery": Conversion failed when converting the nvarchar value 'x' to data type int.


x = the value in my join in the SQL query.


When I perform the rule on the suspect order, I get a different error message...


     Error in EasyFunction rule: "[rule name]"


     Error in command "SQLQuery": Invalid column name 'x'.


x = the value in my join in the SQL query.

Anders Olsson



The function CopyPaste is used to copy data from the previously active form to the current form.


Regarding the query: From the error message it would seem that you are trying to join and integer column on an nvarchar column.

Does it run in the SQL Management Studio? To be able to help you further with this could you please post your query, or better, the whole rule (.cocu file)?







Please sign in to leave a comment.

Didn't find what you were looking for?

New post