Solved

Issue with generating sequential numbers based on attribute values in FME

  • 21 May 2023
  • 8 replies
  • 27 views

Hello,

I am currently working with FME Desktop 2022 and I have encountered an issue while trying to generate sequential numbers in a column based on attribute values. I have two tables, "Dokumenti" and "KatOperat," and I need to create a connected table called "ListKatPlana." In the "ListKatPlana" table, I have two columns: "ID_KatOperat", "ID_List" and "creationDate".

The challenge I'm facing is generating the values for the "ID_List" column based on the "Koliko" attribute in the "Dokumenti" table. The "Koliko" attribute represents the number of records that should be associated with each "ID_KatOperat." For example, if I have an "ID_KatOperat" of 2304 and the "Koliko" attribute is 9, I need to generate numbers from 1 to 9 in the "ID_List" column for that specific "ID_KatOperat."

I have tried using an aggregator to separate the "ID_KatOperat" and "Koliko" columns, but I'm struggling to find a solution to generate the sequential numbers based on the "Koliko" attribute for each "ID_KatOperat." I have tried various methods, but I am also encountering an issue with the Data Type within the Writer format. After writing the code inside the attribute creator using the ValueLoop command or any other type of programming code, I am only getting codes instead of actual values in the rows. The readers are in Excel files.

Could anyone please provide guidance on how to achieve this using FME Desktop 2022 ?

Thank you in advance for your help!

icon

Best answer by geomancer 22 May 2023, 07:53

View original

8 replies

Userlevel 4
Badge +36

Take a look at the Cloner. For "Koliko" = 9 it will output 9 features, with "ID_List" values 0 - 8. Use an AttributeManager to add 1 to "ID_List" for all features.

Cloner

Thank you very much, excellent explanation!

Hello @geomancer​ ,

Considering that you have already successfully answered my question, I would like to ask you about another issue I have. I would appreciate it if you could help me if you know how.

I have a main table called "Documents". I need to create a table called "List" based on data from the "Documents" table. Within the "Documents" table, I have a column called "ElaborationType," and within it, the number 1 represents the main document. Numbers 6, 14, 33 represent documents related to the main document, i.e., they are lists. My goal is to generate results in the "List" table where the "RecordID" in that row matches the "ElaborationType" equal to 1, but it also repeats or duplicates that number based on the numbers 6, 14, 33.

(EXAMPLE: 2302(6), 2304(MAIN DOCUMENT NUMBER 1), 3177(14) belong to the same group because they are in the same cadastral municipality KO_ID).

Within the "List" table, I need to have 2304, 2304 because they are lists for the main document 2304, and they must have their corresponding year from the "FromYear" attribute.

Is it somehow possible to solve this problem using the FME Desktop program? I would be greatly thankful if you could provide assistance. I have provided you with an image of the main table as an example for you to see a sample of the data. I need to do this for the entire dataset; I described just one example, but in the image, you can see that I need to apply this process to the entire dataset.

Userlevel 4
Badge +36

Hi, if I understand correctly, this can be done with a ListBuilder followed by a ListSearcher.

image

Userlevel 4
Badge +36

Next time, could you start a new question? That makes the question and the solution easier to find for other users.

Hi, if I understand correctly, this can be done with a ListBuilder followed by a ListSearcher.

image

It's very similar to what you've done, but here's a slightly better example for you to see how I need the "List" table to look. In this example, you can see exactly what I need to achieve. I simply need to extract the lists from the documents and assign them the "RecordID"(ZapisID) that belongs to the main document number 1, as all these numbers, 6, 14, 33, are subordinate documents to that main one. The attribute "FromYear"(IzGodine) represents the year of data creation. This presents an issue for me because doing this manually would consume a significant amount of time.

exaple2

I have already asked the question on the FME Forum as well. Here is the link: https://community.safe.com/s/question/0D5Dm00000s65epKAA/creating-a-new-table-from-the-main-database-based-on-attributes

Userlevel 4
Badge +36

Thanks, I will continue my answer under that queation.

Reply