Query Members/PrivateMembersData using mainPhone

I would like to look up member based on their mainPhone number in a Dashboard page
Tried this query

MemberResult = await wixData . query ( “Members/PrivateMembersData” )
. eq ( “mainPhone” , $w ( ‘#PhoneNumerInput’ ). value )
. find ()
. catch ( Error =>{
console . log ( Error );
ErrorFlag = true ;
$w ( ‘#ErrorText’ ). text = “Sorry, Phone number is not found " ;
$w ( ‘#SearchingText’ ). show ();
$w ( ‘#SearchingText’ ). expand ();
return ;
});
But I get this error
internal_error, details: {"error":"No value found for ‘mainphone’"}”,“details”:{“category”:“internal_error”,“error”:"No value found for ‘mainphone’

How can I look up the member using their phone number

Still having problems?

I am having the same issue .How to find members using phone number?

Let me check once again and update you soon

any updates Kevin ? Is there a workaround to query members using phone numbers would be really helpful?

Hello can anyone help please am still stuck on this.
This is a basic search for members details by the phone number.

Show excerpt of your database, HEADER + first row of your PMD (Private-Member-Database)

Just to be able to query PMD, you will need something like…

$w.onReady(async function(){
	let data = await start_queryPMD(); console.log('DATA: ', data);
});

async function start_queryPMD() {
	//.eq('mainPhone', $w('#PhoneNumerInput').value)
	return wixData.query('Members/PrivateMembersData')
	.find().then((res)=>{return res})
	.catch((err)=>{console.log('Error: , err'); return err;});
}

In this case you will get some results like…

So the function is working well.
All you have to do now is to REACTIVATE the FILTER.

thanks for response . How can I search for a member that has phone number = “12345” (some number) ?
query on “mainPhone” is not working

Why it is not working?
What exactly is not working?
What do you get as RESULT in your CONSOLE ?

Please describe in more detail.

when I execute this

MemberResult = await wixData . query ( “Members/PrivateMembersData” )
. eq ( “mainPhone” , $w ( ‘#PhoneNumerInput’ ). value )
. find ()
. catch ( Error =>{
console . log ( Error );
ErrorFlag = true ;
$w ( ‘#ErrorText’ ). text = “Sorry, Phone number is not found " ;
$w ( ‘#SearchingText’ ). show ();
$w ( ‘#SearchingText’ ). expand ();
return;
});

I get this error even for phone numbers that exist in the table
internal_error, details: {“error”:“No value found for ‘mainphone’”}”,“details”:{“category”:“internal_error”,“error”:"No value found for ‘mainphone’
[/quote]

Where is the → .then() - part inside of your code?

let myDB = 'Members/PrivateMembersData';
let myFIELD = 'mainPhone';


$w.onReady(()=>{
    //$w ( ‘#PhoneNumerInput’ ).onChange(()=>{
    $w ( ‘#PhoneNumerInput’ ).onInput(async()=>{
         let myVALUE = $w('#PhoneNumerInput').value;
         let data = await myFunction(myDB, myFIELD, myVALUE); console.log('DATA: ', data);
    });   
});


function myFunction(myDB, myFIELD, myVALUE){
    wixData.query (myDB)
    .eq (myFIELD , myVALUE)
    .limit(1000).find ()
    .then((res)={return res})
    .catch ((err)=>{return err});
}

Since you are working with the PMD → you maybe should think about to do your query from the backend and also you should maybe take a look onto the Wix-Members-Backend-API.