IF statement that brings back the value from a row above within the same column

I am converting flat text based journal entries into rows and columns and need to number each journal entry with a unique number. Journal entries start with a date followed by an asterisk then vendor name within quotes. In excel I can use an if statement similar to this

If Row(1) contains * then bring back the value of the row above +1 if not, then bring back the value of the row above.

This assumes the first row within that column starts with the number one (1)hard coded and row two is where the formula begins

So this:

Column
2022-05-29 * “Schindler Elevator Corp” “”
document: “1653946576, 1654013944”
reference: “8105941775, 8105941711”
upstream: “202205291634205220507#20220507”
Assets:AR:Billed:EPark 4,938.38 USD
invoice: “100”
memo: “Elevator”
Liabilities:Bank:Chase:Marriott:JB
2022-05-29 * “Home Depot” “”
document: “1653946577”
upstream: “202205291634195220507#20220507”
Expenses:SmallToolsAndEquipment 64.32 USD
memo: “600v CAT III digital”
Liabilities:Bank:Chase:Marriott:JB
2022-06-12 * “Baltic Networks” “”
document: “1655223555”
reference: “139746”
upstream: “202206121712572220607#20220607”
Expenses:SmallToolsAndEquipment 25.87 USD
memo: “1x routermount”
Expenses:SmallToolsAndEquipment 539.69 USD
memo: “2x Routers”
Liabilities:Bank:Chase:Marriott:JB -565.56 USD

Turns into this:

JE# Column
1 2022-05-29 * Schindler Elevator Corp
1 document: 1653946576, 1654013944
1 reference: 8105941775, 8105941711
1 upstream: 202205291634205220507#20220507
1 Assets:AR:Billed:EPark 4,938.38 USD
1 invoice: 100
1 memo: Elevator
1 Liabilities:Bank:Chase:Marriott:JB
2 2022-05-29 * Home Depot
2 document: 1653946577
2 upstream: 202205291634195220507#20220507
2 Expenses:SmallToolsAndEquipment 64.32 USD
2 memo: 600v CAT III digital
2 Liabilities:Bank:Chase:Marriott:JB
3 2022-06-12 * Baltic Networks
3 document: 1655223555
3 reference: 139746
3 upstream: 202206121712572220607#20220607
3 Expenses:SmallToolsAndEquipment 25.87 USD
3 memo: 1x routermount
3 Expenses:SmallToolsAndEquipment 539.69 USD
3 memo: 2x Routers
3 Liabilities:Bank:Chase:Marriott:JB -565.56 USD

Is this even possible to do using Knime?

Hi @strewartha

Of course this is possible in KNIME, see this wf KNIME_project.knwf (41.1 KB)


Happy KNIMEing!
gr. Hans

2 Likes

This is brilliant! Obviously I am new to Knime. I was thinking it was going to take some tricky Java coding. This opens my mind to other possibilities.

Much Appreciated!

2 Likes

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