Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
lesson_8 [2020/02/10 21:49] argemiro |
lesson_8 [2020/02/11 22:08] (current) hermann [LESSON 8: Inserting and getting a specific value into a table] |
||
---|---|---|---|
Line 4: | Line 4: | ||
====LESSON 8: Inserting and getting a specific value into a table==== | ====LESSON 8: Inserting and getting a specific value into a table==== | ||
\\ | \\ | ||
- | The aim of this lesson is getting and inserting specifics values from and into a table on Dinamica. We will use the **Get Set Table Value**, **Add Table Column**, **Set Table by Key** and **Get Table from Key** functors and the following files: | + | The aim of this lesson is getting and inserting specifics values from and into a table on Dinamica. We will use the [[Get Table Value]], [[Set Table Cell Value]], [[Add Table Column]], [[Set Table By Key]] and [[Get Table From Key]] functors and the following files: |
\\ | \\ | ||
\\ | \\ | ||
Line 14: | Line 14: | ||
**Let's go!** | **Let's go!** | ||
\\ | \\ | ||
- | * From the Input/Output tab, grab a **Load Table** and place it on the sketch. Double click it, browse to the folder ''Guidebook_Dinamica_5\Database\Tables'' and open the ''IBGE_crop_information.csv'' file. | + | * From the Input/Output tab, grab a [[Load Table]] and place it on the sketch. Double click it, browse to the folder ''Guidebook_Dinamica_5\Database\Tables'' and open the ''IBGE_crop_information.csv'' file. |
\\ | \\ | ||
\\ | \\ | ||
Line 24: | Line 24: | ||
</note> | </note> | ||
\\ | \\ | ||
- | * The first two columns are considered the keys of the file, being used to access a certain data in the table. Click on eye button of **Load Table** to see the table. | + | * The first two columns are considered the keys of the file, being used to access a certain data in the table. Click on eye button of [[Load Table]] to see the table. |
\\ | \\ | ||
\\ | \\ | ||
Line 30: | Line 30: | ||
\\ | \\ | ||
\\ | \\ | ||
- | * Grab a **Get Table Value** and place it on the sketch. Connect **Load Table** to **Get Table Value**. | + | * Grab a [[Get Table Value]] and place it on the sketch. Connect [[Load Table]] to [[Get Table Value]]. |
\\ | \\ | ||
\\ | \\ | ||
Line 42: | Line 42: | ||
\\ | \\ | ||
<note> | <note> | ||
- | If the given keys are not found in the input table and the ''Value If Not Found'' parameter, in the Advanced Tab, is not provided, an error will be reported. | + | If the given keys are not found in the input table and the __Value If Not Found__ parameter, in the Advanced Tab, is not provided, an error will be reported. |
</note> | </note> | ||
\\ | \\ | ||
\\ | \\ | ||
- | * From the Table tab, grab a **Calculate Value** and place it on the sketch. Assign a number to Number Value and connect the **Get Table Value to Number Value**. In the ''Connect ports'' window, select ''Value''. | + | * From the Table tab, grab a [[Calculate Value]] and place it on the sketch. Assign a number to [[Number Value]] and connect the [[Get Table Value]] to [[Number Value]]. In the Connect ports window, select __Value__. |
\\ | \\ | ||
\\ | \\ | ||
Line 52: | Line 52: | ||
\\ | \\ | ||
\\ | \\ | ||
- | * Double-click on Calculate value to add a logic or an algebraic expression. We divide v1 (the selected value) by 1000, ''v1/1000'', and click OK. | + | * Double-click on [[Calculate Value]] to add a logic or an algebraic expression. We divide v1 (the selected value) by 1000, ''v1/1000'', and click OK. |
\\ | \\ | ||
\\ | \\ | ||
Line 58: | Line 58: | ||
\\ | \\ | ||
\\ | \\ | ||
- | * From the Table tab grab a **Set Table Cell Value** and place it on the sketch. Connect **Calculate Value** and **Load Table** to **Set Table Cell Value**. In the ''Connect ports'' window, select ''Value'' input port for the output of **Calculate Value**. | + | * From the Table tab grab a [[Set Table Cell Value]] and place it on the sketch. Connect [[Calculate Value]] and [[Load Table]] to [[Set Table Cell Value]]. In the Connect Ports window, select __Value__ input port for the output of [[Calculate Value]]. |
\\ | \\ | ||
\\ | \\ | ||
Line 64: | Line 64: | ||
\\ | \\ | ||
\\ | \\ | ||
- | * Double-click **Set Table Cell Value**. To identify where the sought-after value is located, on the ''Keys'' tab enter ''2001'', ''1'' (corresponding to Year 2001 and Crop 1) and add the Index ''4'' on the ''Column'' tab. | + | * Double-click [[Set Table Cell Value]]. To identify where the sought-after value is located, on the __Keys__ input enter ''2001'', ''1'' (corresponding to Year 2001 and Crop 1) and add the Index ''4'' on the __Column__ input. |
\\ | \\ | ||
\\ | \\ | ||
Line 70: | Line 70: | ||
\\ | \\ | ||
\\ | \\ | ||
- | * From the Input/Output tab, grab a **Save Table** and place it on the sketch. Connect **Set Table Cell Value** to **Save Table**, select a folder and chose a file name (e.g. IBGE_crop_information_update.csv). The final model will look like this: | + | * From the Input/Output tab, grab a [[Save Table]] and place it on the sketch. Connect [[Set Table Cell Value]] to [[Save Table]], select a folder and chose a file name (e.g. IBGE_crop_information_update.csv). The final model will look like this: |
\\ | \\ | ||
\\ | \\ | ||
Line 79: | Line 79: | ||
\\ | \\ | ||
\\ | \\ | ||
- | * Save and run your model. Click on eye button of “Save Table” to see the result. | + | * Save and run your model. Select the [[Save Table]] functor and click on the eye button to see the result. |
\\ | \\ | ||
\\ | \\ |