Skip to main content
Question

input different values from excel to different loops

  • July 27, 2020
  • 2 replies
  • 45 views

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?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

helmoet
Forum|alt.badge.img+8
  • July 27, 2020

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


  • Author
  • July 28, 2020

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?