Is it possible to fetch unique dedicated Business Code for my clients registration?

Hi, @russian-dima Thanks for your quick response. I have uploaded some of snapshots to understand my scenario.

import wixData from ‘wix-data’;

$w . onReady ( function () {
uniqueDropDown1 ();
});
function uniqueDropDown1 (){
wixData . query ( “collection” )
. limit ( 1000 )
. find ()
. then ( results => {
const uniqueTitles = getUniqueTitles ( results . items );
$w ( “#dropdown1” ). options = buildOptions ( uniqueTitles );
});
function getUniqueTitles ( items ) {
const titlesOnly = items . map ( item => item . userType );
return [… new Set ( titlesOnly )];
}
function buildOptions ( uniqueList ) {
return uniqueList . map ( curr => {
return { label : curr , value : curr };
});
}
}

export function dropdown1_change_1 ( event , $w ) {
uniqueDropDown2 ();
$w ( “#dropdown2” ). enable ();
}

function uniqueDropDown2 (){
wixData . query ( “collection” )
. contains ( “userType” , $w ( “#dropdown1” ). value )
. limit ( 1000 )
. find ()
. then ( results => {
const uniqueTitles = getUniqueTitles ( results . items );
$w ( “#dropdown2” ). options = buildOptions ( uniqueTitles );
});
function getUniqueTitles ( items ) {
const titlesOnly = items . map ( item => item . category );
return [… new Set ( titlesOnly )];
}
function buildOptions ( uniqueList ) {
return uniqueList . map ( curr => {
return { label : curr , value : curr };
});
}
}

export function dropdown2_change_1 ( event , $w ) {
uniqueDropDown3 ();
$w ( “#dropdown3” ). enable ();
}

function uniqueDropDown3 (){
wixData . query ( “collection” )
. contains ( “category” , $w ( “#dropdown2” ). value )
. limit ( 1000 )
. find ()
. then ( results => {
const uniqueTitles = getUniqueTitles ( results . items );
$w ( “#dropdown3” ). options = buildOptions ( uniqueTitles );
});
function getUniqueTitles ( items ) {
const titlesOnly = items . map ( item => item . subCategory );
return [… new Set ( titlesOnly )];
}
function buildOptions ( uniqueList ) {
return uniqueList . map ( curr => {
return { label : curr , value : curr };
});
}
}

export function dropdown3_change ( event , $w ) {
uniqueDropDown4 ();
$w ( “#dropdown4” ). enable ();
}

function uniqueDropDown4 (){
wixData . query ( “BusinessRegister1” )
. contains ( “subCategory” , $w ( “#dropdown3” ). value )
. limit ( 1000 )
. find ()
. then ( results => {
const uniqueTitles = getUniqueTitles ( results . items );
$w ( “#dropdown4” ). options = buildOptions ( uniqueTitles );
});
function getUniqueTitles ( items ) {
const titlesOnly = items . map ( item => item . businessCode );
return [… new Set ( titlesOnly )];
}
function buildOptions ( uniqueList ) {
return uniqueList . map ( curr => {
return { label : curr , value : curr };
});
}
}


I just need to get a new unique code (fetched from dataset “BusinessRegister1”) but I am not getting how to eliminate already used code or disable it which already given to a registered user. Kindly help : (