top of page

Forum Posts

Alessandro Boschiero
Oct 10, 2020
In Coding with Velo
With my following code the 'title' property is correctly updated but the multi-reference field 'tag' no. Why this? export function update() { let id1 = 'b4d0f567-d370-46bb-9a7f-9b383065bd3e' //id of an item in 'tag' collection let id2 = '635c6630-5c96-454f-8b38-32336fe2b765' //id of an item in 'tag' collection let toUpdate = [ { _id: '7d9cbc8e-86bb-45d7-9485-9fa3805a84e1', title: 'testBulk 2', tag: [id1,id2] } ] wixData.bulkUpdate("productData", toUpdate) .then( (results) => { console.log('update results: ', results) } ) .catch( (err) => { console.log(err) } ); }
0
0
16
Alessandro Boschiero
Jul 12, 2020
In Coding with Velo
Testing my code i noticed that the geolocation accuracy does not correctly update. Note that geolocation longitude and latitude correctly works fine: when i call my function they are correctly updated. Moreover, using the site from mobile, I noticed that if I leave my site, then open the Google Maps App and then back to my site, the accuracy of the geolocation is updated. It seems strange... Here my code: var currentShopLat, currentShopLong, currentAccuracy export function getAndVerifyCurrentGeolocation () { currentShopLat, currentShopLong, currentAccuracy = "" console.log("Starting accuracy: " + currentAccuracy) $w("#geolocationLoadingGif").expand() $w("#geolocationStatusText").text = "Localizzazione in corso. Attendi alcuni istanti..." $w("#geolocationStatusText").expand() setTimeout( function() { wixWindow.getCurrentGeolocation() .then( (obj) => { currentShopLat = obj.coords.latitude; console.log("currentShopLat: " + currentShopLat) // 32.0971036 currentShopLong = obj.coords.longitude; console.log("currentShopLong: " + currentShopLong) // 34.774391099999995 currentAccuracy = obj.coords.accuracy; console.log("accuracy: " + currentAccuracy) // 29 $w("#infoGeolocationText").text = "Lat: " + currentShopLat + " - " + "Lon: " + currentShopLong + " - " + "(Precisione: " + currentAccuracy + ")" $w("#infoGeolocationText").expand() $w("#geolocationLoadingGif").collapse() if (currentAccuracy > 20) { console.log("Bad accuracy") getAndVerifyCurrentGeolocation() } if (currentAccuracy <= 20) { console.log("GOOD accuracy") } var currentGeolocation = "http://www.google.com/maps/place/" + currentShopLat + "," + currentShopLong; //imposto il link sul tasto "vedi posizione sulla mappa" $w("#goToLocationButton").link = currentGeolocation; $w("#goToLocationButton").target = "_blank"; $w("#goToLocationButton").expand(); } ) .catch( (error) => { let errorMsg = error; }); $w("#geolocationStatusText").collapse() $w("#geolocationErrorText").text = "" }, 4000); } Any suggestions? Thanks in advance!
0
7
146
Alessandro Boschiero
Jul 10, 2020
In Coding with Velo
Why am I getting this error in the collection? My code: let weekHourArray = [ {mondayMorningOpen: "morningOpen", mondayMorningClose: "morningClose", mondayAfternoonOpen: "afternoonClose", mondayAfternoonClose: "afternoonClose"}, {tuesdayMorningOpen: "morningOpen", tuesdayClose: "morningClose", tuesdayAfternoonOpen: "afternoonClose", tuesdayAfternoonClose: "afternoonClose"}, {weddayMorningOpen: "morningOpen", weddayMorningClose: "morningClose", weddayAfternoonOpen: "afternoonClose", weddayAfternoonClose: "afternoonClose"}, {thursdayMorningOpen: "morningOpen", thursdayMorningClose: "morningClose", thursdayAfternoonOpen: "afternoonClose", thursdayAfternoonClose: "afternoonClose"}, {fridayMorningOpen: "morningOpen", fridayMorningClose: "morningClose", fridayAfternoonOpen: "afternoonClose", fridayAfternoonClose: "afternoonClose"}, {satdayMorningOpen: "morningOpen", satdayMorningClose: "morningClose", satdayAfternoonOpen: "afternoonClose", satdayAfternoonClose: "afternoonClose"}, {sundayMorningOpen: "morningOpen", sundayMorningClose: "morningClose", sundayAfternoonOpen: "afternoonClose", sundayAfternoonClose: "afternoonClose"}, ] export function openingsHoursSaveButton_click(event) { $w("#datiNegozioDataset").onReady( () => { $w("#datiNegozioDataset").setFieldValue("openingsHours", weekHourArray); $w("#datiNegozioDataset").save() console.log("Saved") }); } Any suggestions? Thanks in advance!
Array error content media
0
10
49
Alessandro Boschiero
Jul 08, 2020
In Coding with Velo
both with a string and with a variable it seems not to work. What am I doing wrong? API wixData.remove("myCollection", "00001") .then( (results) => { let item = results; //see item below } ) .catch( (err) => { let errorMsg = err; } ); My code option 1 let theImageToRemove = itemData.image3 wixData.remove("Prodotti", theImageToRemove) .then( (results) => { let item = results; console.log("Results: " + results) } ) .catch( (err) => { let errorMsg = err; } ); My code option 2 let theImageToRemove = itemData.image3 wixData.remove("Prodotti", "wix:image://v1/14f014_9151ad2ba9e1495a9dc061064e7c120c~mv2.jpg/AdobeStock_270808675.jpg#originWidth=10000&originHeight=9996") .then( (results) => { let item = results; console.log("Results: " + results) } ) .catch( (err) => { let errorMsg = err; } );
0
5
33
Alessandro Boschiero
Jul 07, 2020
In Coding with Velo
Situation: I have a collection where the geographic position (lat, long) for each field is saved (these fields represent products, for example a t-shirt). Whenever a search is performed on this collection, the results must be sorted by the distance between the user and each field. Problem: I can't sort the elements of the repeater using the data I calculated using the function that calculates the distance. Note: I cannot save the data of the distance between user and product on the collection because this data changes every time a user makes a new search and the repeater is populated. I have tried in every way and I am looking for everywhere but I still have not found a solution. Anyone have any suggestions?
0
3
49
Alessandro Boschiero
Jul 01, 2020
In Coding with Velo
Unfortunately I am having problems with the getCurrentGeolocation () function as it does not return a fairly precise geolocation on certain browsers. For example using Safari browser i can get the precise geolocation, using Chrome I can't. To contextualize the project: I created a collection of geolocated items (with latitude and longitude coordinates). Users "A" can add item to this collection using their current location (I used getCurrentGeolocation () function). Now I am creating a search function within this collection to show the closest items to the user "B" (who is searching these items). To calculating the distance on every item i'm using the formula to find the linear distance between to points on the Earth. But in order to correctly carry out this calculations I must have good geolocation accuracy (error approximately ±10m). I'm looking for a solution everywhere but I haven't found it yet. Any suggestions? Thanks in advance!
2
2
176

Alessandro Boschiero

More actions
bottom of page