I am doing a project and I have a quick question

Hey everyone,

I’m just started doing a project and I am stuck at data manipulation section. I have a couple of questions for you and I would be more than happy if I could get some help on these.

question 1)
I want to create a math formula with if function. Basically what I want to do is:

Name Surname Age ServiceMonth
A B 60 715
C D 60 718

Name Surname Age ServiceMonth
A B 60 715
A B 60 716
A B 60 717
A B 60 718
A B 60 719
A B 60 720
C D 60 718
C D 60 719
C D 60 720

question 2)
I have a variable that calculates number of months of the year that I worked on the project. I want to see when I started the project by adding a new column that reduces the number of months from the date I have. There are also finished projects so not all data is current date. For example: How can I reduce 35 months from 01.05.2020 and get a date?

2 Likes

Hi,

For the first question use Column expressions node and try

if (column(“servicemonth”)<=column(“Age”)*12)
{column(“servicemonth”)+1}
else
{column(“servicemonth”)}

Hello @KeremErkmen,

welcome to KNIME Community!

Math Formula node does have if function and it works as one would expect:
`if (condition, value if condition true, value if condition false)`

Have you tried it?

Br,
Ivan

1 Like

Worked like a charm. Thank you!

Hey ipazin,

Thank you for the reply. I did. My problem is a little more complicated than what I mentioned above. What I am trying to do is duplication of a workflow from Altryx to KNIME. However, the iif function I have on alteryx is a little more complicated than what I can replicate on KNIME, I think. So I have 3 variables that I am using for the iif function in Alteryx. What I am basically trying to do is: Generate Rows if desired variable is between two numbers. The variable names are different from what I mentioned above but I will try to explain the best I can.

So what I have is:
iif([Age_at_Val]>=[Retirement Age]*12,Age_at_BOM<=[Age_at_Val]+1,Age_at_BOM <= [Retirement Age]*12)
which means if the value Age_at_BOM satisifies this condition stop generating rows. If not add +1 to Age_at_BOM and keep generating rows until the function is satisified. I’ve been trying to duplicate this function to KNIME but having a hard time doing so. I would really appreciate the help.

Kerem

Hey andrejz,

I tried implementing the code to my problem. However, the function just stops by adding +1. It doesn’t generate any further rows until the condition is satisified.

Hi,

O my fault … I did not understand very well your problem … I think, to add rows to the table you will have to use one of the loops (maybe Interval loop start) …

Hi,

If I now really understand your problem here is the basic idea on which you can work
KNIME_project KeremErkmen.knwf (36.9 KB)

Thank you for the help. I tried implementing that to my workflow but couldn’t make it work. My problem is a little more complex than this. I wrote about it 3-4 comments above. I was trying to get a basic grasp of things but seems like it is more complicated than I thought it would be. I really appreciate all the help I can get.

Sorry that this is not what you search for.

I also need some more clarification … in your post you write

… in the formula 1 is added to [Age_at_Val] but in the explanation you write that 1 is added to Age_at_BOM … what is correct?

Can you please upload some input sample data with yours 3 variables Age_at_Val, Age_at_BOM and Retirement Age and the desired output,

thank you

So in the alteryx formula it says Age_at_BOM has to start from Age_at_val+1 to RetirementAge*12. I am posting a screenshot of the output data I have in Alteryx. I want to replicate this at KNIME. Sorry if the problem got confusing the language of two programs are not super similar.

The final result for the first person is as following:

When formula reaches retirement*12 it should stop generating rows and go to the next person(identifier) and start doing the same formula for that person.

Sorry I forgot to select reply.

Maybe that gets you started

2 Likes

Hi,

1 Like

Hello there!

Nice one @Daniel_Weikert

@KeremErkmen considering you are coming from Alteryx here is a topic to check:

Br,
Ivan

Thanks Ivan,
also coming originally from Alteryx. But this forum and it’s contributors are amazing when it comes to help each other out.
Highly appreciate that you share your solutions here!
best regards

3 Likes

This was what I am looking for. Can’t thank you enough.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.