Quick note about using these formulas
Using the FormulaMap and AddRow formulas
Using the FormulaMap and AddOrModifyRows formulas

Sometimes you want to put the data returned from a Pack into a table for further analysis. For instance, this formula below utilizes the Stocks Pack to get the latest financials for Ford Motor Company and puts the results in a bulleted list:

While this looks ok on the canvas, being able to write formulas with the financial data would be a lot more useful, so let's put this data into a table!

Quick note about using these formulas

The FormulaMap and AddRow formulas discussed below are one of the ways to add your Packs data (or any collection of data) to a table. Our team is working on more intuitive and easy-to-use methods to accomplish this common pattern, so stay tuned!

Using the FormulaMap and AddRow formulas

You can add rows to a table using the AddRow formula in conjunction with the FormulaMap formula. This will add all the data from your Pack formula regardless if there are duplicates. In the gif below, I created a button called "Add data" which adds the gross profit data for Ford to a table called "Ford Financial Data." The full formula in the button is:

FormulaMap(Stocks::Financials("FORD").GrossProfit,AddRow([Ford Financial Data],[Ford's Gross Profit],CurrentValue))

This formula takes all the gross profit values for Ford (in this case there are 4 values) and applies the AddRow formula to each of these 4 values. The AddRow formula sets the "Ford's Gross Profit" column to the CurrentValue (e.g. the "current" gross profit value the FormulaMap formula is looking at). 

Using the FormulaMap and AddOrModifyRows formulas

In the above example, hitting the "Add Data" button will continually add the gross profit for Ford to the table resulting in duplicates. What if you want to check the table to see if the value already exists? You can use the AddOrModifyRows formula to accomplish this. 

In the example below, I am using the Google Natural Language Pack to pull out the entities from the "Shopping List Items" column:

Let's say I want to add the items to a table called "Shopping List," but that table already contains some of the items like "eggs" and "green beans." With the AddOrModifyRows formula, I can add only the values from my Pack if it doesn't match one of the values in my table. The full formula for the "Add to List" button is below:

Entities.Name.FormulaMap(AddOrModifyRows([Shopping List],Item=CurrentValue,Item,CurrentValue))

Did this answer your question?