Hello,
I had some really great help in https://powerusers.microsoft.com/t5/Building-Power-Apps/Filter-Gallery-based-on-partial-match/m-p/880986 on using variables and filtering a gallery based on a partial match. I have made progress building the SharePoint lists to encompass the data I need and have run into a challenge that the initial solution is working for integers but will not work for strings or a combination of letters, numbers, and special characters.
I have modified the original formula slightly to include more in the regex for MatchAll.
Filter(
DataSource2,
TrimEnds(
Substitute(
Substitute(
Substitute(
Substitute(
Substitute(
Substitute(
Substitute(
Substitute(
DataSource2[@Error],
"XX/XX/XXXX",
""
),
"XXXX ",
""
),
"XXXX",
""
),
"XXX.XXX",
""
),
"XX:XX",
""
),
":",
""
),
"XX",
""
),
".",
""
)
) in ForAll(
DataSource1,
With(
{
thevalue: Concat(
MatchAll(
Error.Text,
"[a-zA-Z= ,\[\]\-_'/]+"
).FullMatch,
FullMatch
)
},
TrimEnds(
If(
Len(
Match(
thevalue,
"(?<= Item ).*?(?=must)"
).FullMatch
) > 0,
Replace(
thevalue,
Match(
thevalue,
"(?<=Item).*?(?=must)"
).StartMatch,
Len(
Match(
thevalue,
"(?<= Item ).*?(?=must)"
).FullMatch
),
""
),
thevalue
)
)
)
)
)
I tried adding 0-9 there as well but that breaks it. Likewise, if I remove a-z or A-Z, it no longer works for the integer ones that are currently working. I'm wondering if the (?=must) is causing the challenge but have gone through these forums and many google searches and cannot seem to find a way to make it work.
Here are some examples of what is working and what is not.
ClearCollect(
DataSource1,
{ID:1,Error:{Text:"Exception in TransmitOrder: Item only valid for sale from 11/23/2018 to 03/27/2021 per Item restriction."}},
{ID:2,Error:{Text:"Exception in TransmitOrder: Item only valid for sale from 11/23/2018 to 03/30/2021 per Item restriction."}},
{ID:3,Error:{Text:"Exception in TransmitOrder: Guest failed age limit check: Age = 1.764, Min = 11.000, Max = 99.000"}},
{ID:4,Error:{Text:"Exception in TransmitOrder: Guest failed age limit check: Age = 10.082, Min = 8.000, Max = 9.999"}},
{ID:5,Error:{Text:"Exception in TransmitOrder: Item can only be sold between 00:00 and 11:45 per Item restriction"}},
{ID:6,Error:{Text:"Exception in TransmitOrder: Item OMNI000014COMBOTIMES1030 must have between 1 and 1 modifiers, and 0 are specified"}}
{ID:7,Error:{Text:"Exception in TransmitOrder: Item cannot be sold on Tuesday per Item restriction."}}
{ID:8,Error:{Text:"Exception in TransmitOrder: Failed to create guest via season pass for ticket[1905097]"}}
);
ClearCollect(
DataSource2,
{Error:"Exception in TransmitOrder: Item only valid for sale from XX/XX/XXXX to XX/XX/XXXX per Item restriction."},
{Error:"Exception in TransmitOrder: Guest failed age limit check: Age = XXX.XXX, Min = XXX.XXX, Max = XXX.XXX"},
{Error:"Exception in TransmitOrder: Item can only be sold between XX:XX and XX:XX per Item restriction."},
{Error:"Exception in TransmitOrder: Item XXXX must have between XX and XX modifiers, and XX are specified"}
{Error:"Exception in TransmitOrder: Item cannot be sold on XXXX per Item restriction."}
{Error:"Exception in TransmitOrder: Failed to create guest via season pass for ticket[XXXX]"}
)
Assuming the information from the data sources above, for DataSource1, ID's 1, 2, 6, and 7 do not work. For ID 7, if I change the word Tuesday which is the variable to a number only such as 1234, it will then work. It seems to me that the dates with slashes in them and any case where there is a string, it does not work.
ID's 3, 4, 5, and 8 all work perfectly.
Any help in trying to figure out how to adjust my formula to work for strings as well would be greatly appreciated.
Thank you!