Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Connect Numeric field with Drop Down

Avatar

Level 3

I have One Numeric Field for PostCode and one drop down list for city.

I want when i write the PostCode in Numeric Field to show automaticly the city in Drop Down list.

And same when I chose to Drop Down list then to show in Numeric Field (PostCode)

I have all that in Excel.

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 8

Use dynamic properties.

First export the xml from your excel spreadsheet (you're on your own with that one). Assuming each row is a city and a postal code, your xml should look like this:

<Root>

<Row>

     <City>SomeCity</City>

     <PostalCode>12345</PostalCode>

</Row>

.

.

.

1) In Designer, go File>New Data Connection...

2) Select Sample XML Data and the file from Excel.

3) Make sure dynamic properties are enabled, Tools>Options>Data Binding>Show Dynamic Properties.

4) Select your drop down and open the Field tab under the Object Palette.

5)You'll notice List Items is green and underlined. Select it.

6) For Items, select Row

7) For Item Text, select City

8) For Item Value, select PostalCode

You now have your drop down bound to the data from your Excel spreadsheet.

Now, just a bit of coding (hang in there), in the numeric field for your postal code, in the exit event put:

theDropDown.rawValue=this.rawValue;

and for theDropDown put:

thePostalCode.rawValue=this.rawValue;

Now all you have to do is import the xml into your form at runtime.

Kyle

View solution in original post

3 Replies

Avatar

Level 5

Hi,

On the exit event of the numberic field you need to capture the value of the numeric field and using switch case you need to update the drop down.

below is the sample script.

switch (this.rawValue) {

            case "postal1":

                dropdown.rawValue  = "City1";

                break;

  case "postal2":

  dropdown.rawValue  = "City2";

  break;

  case "postal3":

  dropdown.rawValue  = "City3";

  break;

  default:

                dropdown.rawValue = "default city";

                break;

        }

But you need to create the dropdown with all the city name before scripting.

You need to follow the same scripting for the next task also.

Thanks

Vjay

Avatar

Level 3

I must to do this for every city?
Because I have 5500.

Avatar

Correct answer by
Level 8

Use dynamic properties.

First export the xml from your excel spreadsheet (you're on your own with that one). Assuming each row is a city and a postal code, your xml should look like this:

<Root>

<Row>

     <City>SomeCity</City>

     <PostalCode>12345</PostalCode>

</Row>

.

.

.

1) In Designer, go File>New Data Connection...

2) Select Sample XML Data and the file from Excel.

3) Make sure dynamic properties are enabled, Tools>Options>Data Binding>Show Dynamic Properties.

4) Select your drop down and open the Field tab under the Object Palette.

5)You'll notice List Items is green and underlined. Select it.

6) For Items, select Row

7) For Item Text, select City

8) For Item Value, select PostalCode

You now have your drop down bound to the data from your Excel spreadsheet.

Now, just a bit of coding (hang in there), in the numeric field for your postal code, in the exit event put:

theDropDown.rawValue=this.rawValue;

and for theDropDown put:

thePostalCode.rawValue=this.rawValue;

Now all you have to do is import the xml into your form at runtime.

Kyle