Setting Fields Using Validators


On several previous posts, we have looked at obtaining data from other IDO’s – we’ve used SP’s, we’ve used secondary ido collections and we’ve used VB code – all of which are great, but in this example I am going to use a component class and a validator. This is purely an exercise for demonstration purposes, so I’ve positioned 2 components on a form I use as a sandpit and am going to set it to get data from one of our inhouse IDO’s

Firstly I need to say thanks to Kris Hawkes – he called me asking how to do this and I couldn’t work it out – he went away and 2 hours later came back and showed me how it works!

1) Set up a new component class be doing the following

a) Drop into design mode

b) Edit –> Component Class –> New

c) Give the Validator a Name, and a list source

AddComponentClasss

d) Add a list source and ensure to include all of the properties you require – you can only display a single column if you want. Ours is shown here :-

listsource

 

 

2) Add a new Dropdown list to your form

a)Give it a name (in this case we are calling it “Lookup1” as it is simply for demo purposes)

b) Set the component class to the name of the new component class you have just added

ComboBoxProperty

     c) Come out of design mode and check your combo box, it should have a list source as shown here

ComboBox

3) The next thing to do is add a validator.

a) Drop into design mode

b) Edit –> Validators –> New

c) Name your Validator, set the type to “In Collection” then click the ellipse next to the parameters field

ValidatorProperties

d) Set the IDO name, then use the forms to set the Component property as shown here

ValidatorParameters

BUG ALERT! Do not key the values into the form “Edit in Collection Validator Parms” In both Syteline 8 and Syteline 9 it does not work and the data is not saved – you have to use the sub-forms!

e) Set the “in collection only” property to the property you are passing in (in our example “Brand”)

4) Return to your Component Class and add the new validator to the properties & set “Validate Immediately” to true

ComponentClassValidator

5) Setup the component to be updates

a) Return to your form and add a new edit box to the from – in our example I have named it “lookupresults1”

b)  Go to the parameters for the combo box you added earlier and add in the name of the component you wish to update when the data in the combo box changes as shown here.

final

6) Come out of design mode and test – it should now work!

working

Leave a comment

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