replace of rows based on the value of columns

Hi everyone,

I have a table like this and I want to replace row orders based on the values of the Row ID column.
I tried the rule engine but it seems I can’t access the specific cell of a column in that.

something like that:

$$ROWID$$ =“R1C1” =>$$ROWID$$=“R2c1”.$values$

Thanks in advance

Hi @Sajjadmosaheb,
i don’t get your problem. Please could you provide based on your example the expected outcome to make it easier to find solutions.
BR

2 Likes

Hello @Sajjadmosaheb,

in Rule Engine node there is no such syntax. Have a feeling you might need Cell Replacer node with additional reference table to do such replacement. However agree with @morpheus additional explanation + expected outcome sure would help :wink:

Br,
Ivan

1 Like

Hi @Sajjadmosaheb , you can’t replace $$ROWID$$ like that. You can use its value, but you cannot change its value, at least not like this.

So, you can run your rule engine using $$ROWID$$, and assign the results to a new column first.

Then you can use the Row ID node to replace the Row ID column by that new column you created.

And to clarify, what are you trying to do here $$ROWID$$="R2c1".$values$? Are you trying to join “R2c1” with column values? The Rule Engine does not allow you to do string manipulation, only logic, and String Manipulation does not allow logic, only string manipulation. You may want to use Column Expressions where you can use logic and do string manipulation.

Something like this:

if($$ROWID$$ == "R1C1") {
  join("R2c1", column("values"))
} else {
  $$ROWID$$
}

And send this result into a new column called MyRowID.

Then replace RowID by MyRowID via the Row ID node.

Note: The other assumption that I have is that by "R2c1".$values$, you mean the value of column values where Row ID is “R2c1”. However, because there is no “R2c1” in Row ID (though there is R2C1, which is different), I did not follow this assumption. If this is what you actually want, this can easily be done also.

2 Likes

This is the output that I want:
swapping specific rows.
for this example, swapping every row with RowID “R1” with “R2”.

Hi @morpheus,
Thanks for reply,
Sorry for miss understanding
The expected output added.

best
sajjad

Hi @ipazin,
Thanks for reply

sorry for the little description.
yes, I’m aware that rule engine can’t effort in this one, I really don’t know what node can help for this problem.
I want whole rows replace with another based on the rowId name (or some column) I don’t think Cell Replacer is useful here.

best
sajjad

Hi @bruno29a,

Thanks for reply,
yes exactly the second assumption is the one I want ( Sorry the lowercase C was due to a typo)

best
sajjad

Hi @Sajjadmosaheb , based on what you originally gave, I don’t think any of us would have ever guessed that you wanted to swap the position :rofl:

My assumption does not even cover this :D, but is probably the closest. Most requests/operations that we see is to manipulate the data, like replacing values etc.

In any case, I put something for you for the swapping you requested, that looks like this:

Input data:
image

Results:
image

Here’s the workflow: Swapping Row IDs.knwf (22.3 KB)

@ipazin , it’s a pity that Column Expressions cannot access $$ROWID$$ (and the other 2, ROWINDEX and ROWCOUNT) but only columns and variables.

6 Likes

Hi @bruno29a,

Thanks, it’s worked
but I have guessed for such thing it must be a fewer node uses problem :smiley:

best
sajjad

1 Like

Hello @bruno29a,

You mean these ones? :slight_smile:

RowFunColExpr

Br,
Ivan

3 Likes

Hi @ipazin , ahhhh, I seeee!! Thanks for pointing them out. That would have saved me from having to convert the Row ID to a column. Now I’ll know for the future :smiley:

Thanks again

2 Likes

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