Question

input different values from excel to different loops


I am using looper to modelize the daily temperature. I want to input different values from different cells in Excel to do the calculation in each loop.(For example, input Value A1 to calculate Loop1, A2 to Loop2 ) Is it possible for me to do that in FME?


2 replies

Badge +2

Hi @yonshum, A little more information on how you are planning to use the looper would be nice. As I understand now, you are trying to read an Excel sheet and you want each cell to be individually identifiable.

You can do this by creating the Excel Reader, and in the Parameters section enter on the Field Names Row the value <blank> :

You also need to expose the format attribute xlsx_row_id:

After that you can use an AttributeExploder to create Name/Value pairs for each column in the sheet. Be sure to set Keep Attributes to Yes:

Finally using a StringSearcher on the attribute _attr_name (or whatever you called it on the AttributeExploder) you can check if your attribute is needed, e.g., it's name should not contain an underscore character:

You will now have a list of features, each being the cell value at row xlsx_row_id and at column _attr_name, which can be used to direct your Looper. You can remove the remaining attributes from other columns, since the value of the cell is in the attribute _attr_value.

This is how my setup for a 3x3 matrix ended up, resulting in 9 values:

Attached you'll find this setup in an fmt file.

readexcelindividualcells.fmwt

Hi @yonshum, A little more information on how you are planning to use the looper would be nice. As I understand now, you are trying to read an Excel sheet and you want each cell to be individually identifiable.

You can do this by creating the Excel Reader, and in the Parameters section enter on the Field Names Row the value <blank> :

You also need to expose the format attribute xlsx_row_id:

After that you can use an AttributeExploder to create Name/Value pairs for each column in the sheet. Be sure to set Keep Attributes to Yes:

Finally using a StringSearcher on the attribute _attr_name (or whatever you called it on the AttributeExploder) you can check if your attribute is needed, e.g., it's name should not contain an underscore character:

You will now have a list of features, each being the cell value at row xlsx_row_id and at column _attr_name, which can be used to direct your Looper. You can remove the remaining attributes from other columns, since the value of the cell is in the attribute _attr_value.

This is how my setup for a 3x3 matrix ended up, resulting in 9 values:

Attached you'll find this setup in an fmt file.

readexcelindividualcells.fmwt

Thank you!! I really appreciate your answer. I would describe the situation here more specifically. In my Workflow Model, the daily soil temperature is decided by itself and other parameters one day before.

For example, I created column A (the present soil temperature Ts1), column B(air temperature Ta1), and column C(the soil temperature next day Ts2) in Excel and I had the soil temperature from day 1 and daily measure data of air temperature for 3 days.

 

 

I have created a looper in FME, i wanna input Cell A2, B2 to calculate and output the value in C2 at the first looping.

At the second looping the value in C2 would automatically return as input value A3. With the measure value B3, the value C3 would be calculated, until we have all the soil temperature for 3 days.

How can i use the reader, writer, and looper in FME to achieve this?

Reply