Abubakar anwar Posted September 7, 2022 Share Posted September 7, 2022 Attached the excel file. Imagine this is the table i have in Spotfire.for row 3 and 7, i want to add one number and for all others i want a different numberthis to be added in a calculated column. does anyone have a solution to this? Link to comment Share on other sites More sharing options...
Gaia Paolini Posted September 8, 2022 Share Posted September 8, 2022 you could use the function rowId() to add a row id then calculate the column depending on the value of the row id. Link to comment Share on other sites More sharing options...
Abubakar anwar Posted September 9, 2022 Author Share Posted September 9, 2022 I want to make it dynamic. what i am looking for is the ability to select random rows and for those row to be able to add values "numbers" and add it to an existing column to create the value of my new "Calculated col". i am not sure if that explains what i want. Link to comment Share on other sites More sharing options...
Gaia Paolini Posted September 9, 2022 Share Posted September 9, 2022 hmm no I do not understand. The user selects random rows. Then how are the numbers chosen? And what is the existing column that the number is added to? Do you mean take an existing column and add a number to it? You would need to create a new column.Based on my limited understanding, I guess you need a script of some sort, Iron Python or Python/R. Link to comment Share on other sites More sharing options...
Abubakar anwar Posted September 9, 2022 Author Share Posted September 9, 2022 yes that is probably what i believe too. so i have an existing column "A" with values let's say for explanation purpose "All the countries in the world."then i have another column "B" containing numbers "1-10"so the calculated column "C" needs to be populated with the " rows i select from column A, add the number from column B to the new calculated column C.I hope this explains the situation. any support will be appreciated.thanks Link to comment Share on other sites More sharing options...
Jose Leviaguirre Posted September 9, 2022 Share Posted September 9, 2022 Hello Abubakar. Can you be even more specific? Can you kindly provide a non abstract example and the expected output? The first example shows 1 on column C for those columns that matches the values from columns A and B. When you talk about "selecting" rows, are you referring to "marking" them? Link to comment Share on other sites More sharing options...
Abubakar anwar Posted September 9, 2022 Author Share Posted September 9, 2022 Hi Jose,i am attaching a sample excel file with explanation. let me know if this helps. Link to comment Share on other sites More sharing options...
Jose Leviaguirre Posted September 9, 2022 Share Posted September 9, 2022 1. Create a python data function that takes an x column as an input parameter and outputs an x column (x is your input and output column script parameters)x[:]=[i+1 for i in x]2. Run the data function and select your current_holidays column as the input for x and select the marking to limit the data from3. For the output choose to map the input rows to x and replace columns on update. You can choose to refresh the function automatically if you want to 4. Create a calculated column to replace the null values from the data function outputsn([current_holidays (2)],[current_holidays] + 5) Link to comment Share on other sites More sharing options...
Abubakar anwar Posted September 13, 2022 Author Share Posted September 13, 2022 thank you Jose. i will try this as one.in the mean time i tried using input filed function with multiple lines and it worked. i will definitely try your solution as wellmany thanks for your support.highly appreciated Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now