Calulate Random String Question

Hi ,

I am making a referral system and using the calculate random string to generate a 5 digit code.This all works properly.
My question is

  1. Is there any way to search the users, to make sure no other user has the same 5 digit promo code generated?
    This is how I am tracking referrals so no 2 users can have the same code.


maybe this would be helpful to you in the screenshot bellow. I think this means if there is more than 1 code then generate another code.

you can also go to live link : Marketplace-sample | Bubble Editor