Code Snippet #1
For referral code generation in Power Fx
   Concat(
        FirstN(
            Shuffle(
                Split(
                    "abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz0123456789",
                    ""
                )
            ),
            8
        ),
        Result
    )
Explanation
- 
    
Split("abcdefghijklmnopqrstuvwxyz...6789", ""): - This function splits the provided string into an array of individual characters. The string is a long sequence of the alphabet followed by numbers 0 to 9, repeated several times. The split delimiter is an empty string"", so each character in the string becomes a separate item in the resulting array. - 
    
Shuffle(...): - This function takes the array created bySplitand randomizes the order of its elements. After this, the array’s elements (individual characters) are in a random order. - 
    
FirstN(..., 8): - This function takes the first 8 elements from the shuffled array. Since the array was randomized byShuffle, these 8 characters are randomly selected each time the formula is run. - 
    
Concat(..., Result): - TheConcatfunction is used to concatenate (join together) the elements of the array.Concatwould take an array or table and a formula to apply to each record of that array/table. In this case, it is to join the 8 random characters into a single string. IfResultis intended to be used. 
So, the overall purpose of this formula to generate a random string of 8 characters, each character being a letter (a-z) or a digit (0-9) i.e referral code in this case.
Happy #low-code learning
Dr. Amit Puri, Advisor and Consultant, Strengthening Digital Experiences, Modernize Cloud Journey with AI-Driven Transformation!