web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Troubleshooting a FInd...
Power Apps
Suggested Answer

Troubleshooting a FInd function

(1) ShareShare
ReportReport
Posted on by 831 Moderator
I have this bit of code  as the text for a label. It gives me a "The third argument to the 'Find' function must be less than or equal to the length of the second argument". I was getting this error until the label was populated. Once it was populated the error went away and I could submit the form. It was functioning for 390 records. Now, I always get the error and can't submit any new records. Any ideas what is happening?
 
Substitute(
    Left(
        Mid(
            TXT_LinkDestination.Text, 
            Find("/", TXT_LinkDestination.Text, Find("//", TXT_LinkDestination.Text) + 2) + 1, 
            Len(TXT_LinkDestination.Text)
        ), 
        Len(
            Mid(
                TXT_LinkDestination.Text, 
                Find("/", TXT_LinkDestination.Text, Find("//", TXT_LinkDestination.Text) + 2) + 1, 
                Len(TXT_LinkDestination.Text)
            )
        ) - If(
            Right(
                Mid(
                    TXT_LinkDestination.Text, 
                    Find("/", TXT_LinkDestination.Text, Find("//", TXT_LinkDestination.Text) + 2) + 1, 
                    Len(TXT_LinkDestination.Text)
                ), 
                1
            ) = "/", 
            1, 
            0
        )
    ), 
    "/", 
    ":"
)
 
Categories:
I have the same question (0)
  • Suggested answer
    WarrenBelz Profile Picture
    153,073 Most Valuable Professional on at
    Sort of hurts my brain looking at it and the logic seems a bit over complicated, however to answer your question and save a heap of typing
    With(
        {
            _Mid: Mid(
                TXT_LinkDestination.Text,
                Find(
                    "/",
                    TXT_LinkDestination.Text,
                    Find(
                        "//",
                        TXT_LinkDestination.Text
                    ) + 2
                ) + 1,
                Len(TXT_LinkDestination.Text)
            )
        },
        If(
            Len(TXT_LinkDestination.Text) > 0,
            Substitute(
                Left(
                    _Mid,
                    Len(_Mid) - If(
                        Right(
                            _Mid,
                            1
                        ) = "/",
                        1,
                        0
                    )
                ),
                "/",
                ":"
            ),
            ""
        )
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard