DataCardValue7.Selected.Name & Mod(Year(Today()), 100) & "-" &
If(
IsBlank(
Max(
Filter(
'AGTRS Trial Request Tables',
StartsWith(TrialCode, DataCardValue7.Selected.Name & Mod(Year(Today()), 100) & "-")
),
Value(Mid(TrialCode, Len(DataCardValue7.Selected.Name & Mod(Year(Today()), 100) & "-") + 1, Len(TrialCode)))
)
),
1,
Max(
Filter(
'AGTRS Trial Request Tables',
StartsWith(TrialCode, DataCardValue7.Selected.Name & Mod(Year(Today()), 100) & "-")
),
Value(Mid(TrialCode, Len(DataCardValue7.Selected.Name & Mod(Year(Today()), 100) & "-") + 1, Len(TrialCode)))
) + 1
)
I am getting this error with the formula you have provided.
Invalid number of arguments: received 3, expected 2.
With(
{
_Year: Mod(Year(Today()), 100) & "-",
_Name: DataCardValue7.Selected.Name
},
With(
{
_Table:
Filter(
'AGTRS Trial Request Tables',
StartsWith(TrialCode,
_Name & _Year,
)
)
},
_Name & _Year &
If(
CountRows(_Table) = 0
Value(
Mid(
TrialCode,
Len(_Name & _Year) + 1,
Len(TrialCode)
)
),
1,
Max(
_Table,
Value(
Mid(
TrialCode,
Len(_Name & _Year) + 1,
Len(TrialCode)
)
) + 1
)
)
)
)
I hope that helps