Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
lesson_7 [2019/09/19 13:38] britaldo |
lesson_7 [2020/02/10 21:46] argemiro |
||
---|---|---|---|
Line 4: | Line 4: | ||
====LESSON 7: Creating a new column and retrieving a data column from tables==== | ====LESSON 7: Creating a new column and retrieving a data column from tables==== | ||
\\ | \\ | ||
- | * To create a new column in a given table we must open all the files that will be used to retrieve data from. Click on the Input/Output tab from the library window and grab three **Load Lookup Table** Functors and one **Load Table** placing them on the sketch. Open the **Load Lookup Table** functors and load the files ''1999_production_value.csv'', ''1999_harvested_area.csv'' and ''1999_production.csv'' from the folder ''Database\Tables\''. Next, open **Load Table** and load ''IBGE_crop_information_uptated.csv''. | + | * To create a new column in a given table we must open all the files that will be used to retrieve data from. Click on the Input/Output tab from the library window and grab three **Load Lookup Table** Functors and one **Load Table** placing them on the sketch. Open the **Load Lookup Table** functors and load the files ''1999_production_value.csv'', ''1999_harvested_area.csv'' and ''1999_production.csv'' from the folder ''Guidebook_Dinamica_5\Database\Tables\''. Next, open **Load Table** and load ''IBGE_crop_information_uptated.csv''. |
\\ | \\ | ||
\\ | \\ | ||
Line 27: | Line 27: | ||
* Add a **Set Table by Key** to the sketch, assign the output of **Add Table Column** to the __Subtable__ input port of **Set Table by Key** and the **Load Table** with ''IBGE_crop_information_uptated.csv'' to the __Table__ port. In the Functor Editor window, enter ''1999'' as the key identifying the sub-table that will be updated or inserted. Additionally, toggle the Ignore Column Names flag in the Functor Editor Window. | * Add a **Set Table by Key** to the sketch, assign the output of **Add Table Column** to the __Subtable__ input port of **Set Table by Key** and the **Load Table** with ''IBGE_crop_information_uptated.csv'' to the __Table__ port. In the Functor Editor window, enter ''1999'' as the key identifying the sub-table that will be updated or inserted. Additionally, toggle the Ignore Column Names flag in the Functor Editor Window. | ||
\\ | \\ | ||
- | * To save the result to a file, place a **Save Table** on the sketch, browse to ''Dinamica EGO\Guidebook Dinamica_4\Models\Set_2\basics\'' and write the file name (e.g. ''IBGE_crop_information_complete''). | + | * To save the result to a file, place a **Save Table** on the sketch, browse to ''Guidebook_Dinamica_5\Models\Set_2\basics\'' and write the file name (e.g. ''IBGE_crop_information_complete''). |
\\ | \\ | ||
* Click on the layout tool Execute Layout. Your final model should be similar to the one below: | * Click on the layout tool Execute Layout. Your final model should be similar to the one below: | ||
Line 71: | Line 71: | ||
\\ | \\ | ||
\\ | \\ | ||
- | * To save the result to a file, open **Save Table**, browse to ''Documents\GuideBook Dinamica\Guidebook Dinamica_4\Models\Set_2\basics\ Get_Table_from_Key'' and write the file name (e.g. IBGE_crop_information_update). | + | * To save the result to a file, open **Save Table**, browse to ''GuideBook_Dinamica_5\Models\Set_2\basics\ Get_Table_from_Key'' and write the file name (e.g. IBGE_crop_information_update). |
\\ | \\ | ||
\\ | \\ | ||
Line 77: | Line 77: | ||
\\ | \\ | ||
\\ | \\ | ||
- | * Save and run the model. To see the resulting table, click on eye button of “Save Table”. This functor output is a table that looks like this: | + | * Save and run the model. To see the resulting table, click on eye button of **Save Table**. This functor output is a table that looks like this: |
\\ | \\ | ||
\\ | \\ |