How to change a number into a text string

Hi guys this is probably an easy one for you, I have two search boxes on my home page and want to display how many times people have made a search, I have implemented a code and it works to a degree but isn’t showing any commas on the live preview, it shows commas in the database but doesn’t copy over.

highly appreciate any help on this thanks

The simplest way without using some RegEx would be this:

yourNumber.toLocaleString('en');

Thanks bud, I’m actually a newbie to coding , where would I had this line? do I replace the ++ symbols marked in the picture with the red arrow?

This is the code I have to run the two search boxes and also show a count of searches

import { local } from ‘wix-storage’;

import wixLocation from ‘wix-location’;

import wixData from ‘wix-data’;

$w.onReady( function () {

});

export function searchButton_click(event) {

let word = $w(“#searchBar”).value;

let words = $w(“#searchBar2”).value;

local.setItem("searchWord", word); 

local.setItem("searchWords", words); 

wixData.query("MemberProfile").find().then((result)=>{ 

let MemberProfileitem = result.items[“0”]; //item with values
let id = MemberProfileitem._id; // this will be used for
//writing data back

    MemberProfileitem.profileClicks++; 

// increment field with yes by 1
// write updated value back to collection
wixData.update(“MemberProfile”, MemberProfileitem).then(()=>{
// refresh dataset to show new value
//(this should be done in promise,
//after updating collection)
$w(“#dataset2”).refresh();
wixLocation.to(/user-profile-data);
});
}) ;
}

@millwards322 You would disconnect your text element the editor GUI way, and connect it through code instead.

Keeping in mind you have to replace the searches in red with the key for the appropriate field in your collection…place this somewhere inside your $w.onReady(function(){ }

$w('#dataset2').onReady(()=>{
    const myCount = $w('#dataset2').getCurrentItem().searches;
    $w('#count').text = myCount.toLocaleString('en');
});

@skmedia

Hi David your a star Mate, I’ve done it now and it works :slight_smile: not sure whats going on with corvid but it’s really slow and buggy it wouldn’t let me reply earlier!

I have a few other issues with my site, which you might be able to help me with too :+1:t2: I can paypal you a drink over :wink:

  1. i want the trader who as signed up to receive a bell notification and email, when someone leaves a review on there dynamic profile.

  2. I want the trader to upload multiple images files of recent work they’ve done on one upload button.

  3. I want a repeater on my home page to function as a slider gallery of information on any recent reviews left by customers thats tied to a picture of that particular trader.

  4. lastly i want the list of profiles that populate on a page when someone does a search to show the overall rating they have received on there own profile page

might be a few other things too lol

Cheers

@skmedia read below comment thanks

Hey Stevo, no problem. Go ahead and shoot me an email with the stuff you need to get done/fixed. It would be more convenient/easier for me to read through.

Thank you!!!

Thank you!!!