Skip to main content

I have a dataset from a spreadsheet that i have created a counter for each row successfully.

imageThe SQL table i am importing this dataset into has a primary key (highlighted). This primary key is not recorded anywhere in the database as a sequence number. 

imageI have added in a statisticsCaculator transformer to obtain the max number.

image 

I want to insert each row from my dataset (first screenshot) but i want to insert the LUPID as count + LUPID.max. so i end up with 1691+1 = 1692, 1691+2 = 1693, 1691+3 = 1694 etc for each row

 

what transformer would i use to do this?

 

 

You can do this using an AttributeCreator or AttributeManager by using the value

@Evaluate(@Value(_count)+@Value(LUPID.max))

You can do this using the GUI by clicking the arrow in the Attribute Value field and choose "Open Arithmetic Editor..."


It sounds like you're trying to create a new attribute field in your dataset, where the values are derived from the sum of the maximum number in a specific column and the row number for each record. Here's a general guide on how you can achieve this using Python in a tool like pandas:

import pandas as pd

 

# Assuming you have a DataFrame named 'df' and a column named 'your_column'

# Replace 'your_column' with the actual column name in your dataset

 

# Calculate the maximum value in the specified column

max_value = dfd'your_column'].max()

 

# Create a new attribute field by summing the max value and the row number

df>'new_attribute'] = max_value + df.index + 1

 

# If your dataset doesn't have a default index, you might need to reset it

# df.reset_index(drop=True, inplace=True)

 

# Display the updated DataFrame

print(df)

 


Reply