Bootstrapping with a reference key column

Bootstrapping with a reference key column

  

Hi,


I am importing from Excel for two separate tables. One is "Metro Area", with an auto-numbered id. Ex.:

MetroAreaId                     MetroAreaName

1                                       New York

2                                       Los Angeles

3                                       Chicago

...

The second table with be zip codes linked to metro area ids, a FK of "MetroAreaId." This table of course also already has data. Ex.:


ZipCode                           MetroAreaId


10001                              1

90210                              2

...


How can I bootstrap both these tables and at the same time make the existing data in "MetroZipCodes" in the "MetroAreaId" column be a FK referenced to "MetroArea" "MetroAreaId"?


Thanks for any suggestions!

Reid C.


Hello Reid

Please find attached the .oml where you can find how to solve your issues.

Basically:
1) Create an Excel file with column Name for the Metro Area table
2) Create an Excel file with columns ZIPCode and Metro Area Name for the ZIPCode table (in the 2nd column you should type the name of the Metro Area you want, NOT  the id)

3) Bootstrap table Metro Area (publish to populate the table)

4) Bootstrap table ZIPCode (do NOT publish)

5) Add an attribute to the Excel_ZIPCode named MetroAreaName

6) Add the little bit of code in the second bootstrap as shown on the .oml


if you have any issues, let me know


Regards,

Ângelo