To get a collection that only contains the repeated values, you need to identify which values appear more than once in the PedidosSolicitados collection.
Solution:
Create PedidosSolicitados – This contains all values from TextInput2.Text, split into individual items.
Create ValoresUnicos – This gets the distinct values.
Create RepeatedValues – This filters only the values that appear more than once.
Here’s how you can modify your approach:
ClearCollect(
PedidosSolicitados,
Filter(
Split(Trim(TextInput2.Text), " "),
!IsBlank(Value)
)
);
ClearCollect(
ValoresUnicos,
Distinct(PedidosSolicitados, Value)
);
// Collection that contains only repeated values
ClearCollect(
RepeatedValues,
Filter(
ValoresUnicos,
CountIf(PedidosSolicitados, Value = ValoresUnicos[@Value]) > 1
)
);
Explanation:
The PedidosSolicitados collection holds the raw values.
The ValoresUnicos collection extracts unique values.
The RepeatedValues collection filters only those values that appear more than once by using CountIf.
Expected Output:
For input: "Request1 Request2 Request1"
PedidosSolicitados:
Value
------
Request1
Request2
Request1
ValoresUnicos:
Value
------
Request1
Request2
RepeatedValues:
Value
------
Request1
This ensures you only get items that have been repeated at least once.