# Replacement Chain

Options

Dear Community,

Hope you can help me with this requirement;

1- In fact, we have a list of products and we want to replace it for example:

We have : A replaced by B then B replaced by C and C replaced by D what makes a chain of substitution A-B-C-D. What I want to display on each line is the first product of the chain in our case "A"

N.B :

- New Product : enterable by User

- First Product of the chain : calculated by formula and displayed

- Warning : calculated by formula and displayed

2- I want to display error message on this specific case (we cannot replace the same product twice, for example we cannot have A replaced by B and G replaced by A.).

Thank you for your help

Tagged:

• Options

@TAGORTII just stuck with your warning message.  Do i understand correctly that the order of the list members matters in calculation? I can see in your example that error message is only against "I" because NEW PRODUCT mentionned there is "G". And "G" stays prior to "I". I am asking because if we ignore the error, then the chain will look like this: I-G-J,  which can be calculated as FIRST PRODUCT OF THE CHAIN  = "I".

Or this means that error appears only if any product mentionned more that once?

If this is actually the case then you have to concider the above in your calculation.

• Options

Hello @KirillKuznetsov ,

In fact the order doesn't matter, the error must appear when an old product (already substituted) is used as a new product for another product.

Regards,

• Options
In this case B and C also follow this rule and must be NOK. At least this is what I see on your screenshot. Could you comment on that?
• Options

In the first case is as follows : A-B-C-D so no error.
In the second case : E-F and G-E so the chain will be G-E-F this is an error on the second line.

• Options
I don't see any difference, but the order in which the new products are assigned and only in case if the order of the products matches with the order of new products being assigned
• Options
Another question. Do these new products have to appear only once in the line item?
• Options

The order of the new product assignment and the occurrence of the new products differs from the first case.
If I already substituted a product i cannot used as a new product.
Did you find a solution for the first part of the requirement ?

Thanks

• Options

yes one time

• Options
Do you know the maximum length of such chain?
• Options

@KirillKuznetsov I think  the maximum should be at 40-50