Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Flex to change UDFx default value 1

Status
Not open for further replies.

BryonL

Technical User
Dec 17, 2003
2
US
I need to change an OE0101 user defined field default to match the value of a user defined field in the customer record of the customer for whom the order is placed. Both UDFs are formatted as checkboxes.

I know how to use Flex to write the value directly to the order header table, but need to allow the user to change the default value read from the customer record.

Example:
Customer 1 has UDF1 = 'Yes'. OE0101 has UDF1 checkbox unhidden at the bottom of page 1. When the cus. no. is entered, the default value of UDF1 should change to 'Yes'. The user can then leave it as is, or change to 'No' before proceeding to page 2.

Thanks!
Bryon
 
Hi Bryon,

This is always a tricky one in Flexibility, because you can not change the value of a control without first having focus on the field. This essentially means that you need to tab to the field in question, have focus, and make your changes.

Here is the essence of what you should do to create a solution.

1. Create a flag at the module level to store whether you have populated the user defined field on an order yet. (e.g. Private bHavePopulated as Boolean)

2. On the GotFocus event of the Customer Number field reset the bHavePopulated flag to False.

3. On the GotFocus event of the control in the tab order have the "Alt Address" field, check the value of bHavePopulated for a False value. If the value is false use the SetFocus method on the user defined field's control you wish to assign a value to.

4. On the GotFocus event of your user defined field check the value of bHavePopulated for a False value. If the value is false, retrieve the value you wish to set your user defined field to, set the value, set the bHavePopulate flag to True, and set focus back to the field you originally used the .SetFocus method from.

This may not work in all environments, but can be adapted to your needs.

Scott Travis
infoSpring, LLC.
 
I would also suggest that you not put the UDF on the OE form as the last thing on the form. Move it up to after the alt address. A lot of times the flex events do not necessarily fire in the order we think they should. Having the field as the last control on the header may switch the form to the line item entry on lost focus instead of back to the field you came from.

Just my $.02

Andy

Andy Baldwin
 
Thanks All; it is much appreciated.

Bryon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top