Linking A Button To Dynamic Page Through Code

Linking a button to dynamic page can also be done like →

let user = wixUsers.currentUser;
let userId = user.id; 
 
    wixData.query("UserProfileData")
  .eq("userId", userId)
  .find()
  .then( (results) => {
 if(results.items.length > 0) {
 let items = results.items[0]['link-userprofiledata-all']; //       this is the field of link. 
   
      console.log("let items is " + items);
 let id = `${items}`
      console.log("let id is " + id);

    wixLocation.to(`${items}`);
    } 

  } );