top of page

Forum Posts

Ziv Assor
Content Creator
Content Creator
May 22, 2023
In Velo Pro Discussion
When a visitor uses the upload button element, the uploaded file goes directly to the visitor's upload folder. I would like to know how to set up permissions for a specific file or even for this folder in general. Any guidance on this would be greatly appreciated. Thank you!
0
2
16
Ziv Assor
Content Creator
Content Creator
May 14, 2021
In Coding with Velo
I am trying to add a responsive table to my website. Did anyone try to use tabulator-tables?
0
11
398
Ziv Assor
Content Creator
Content Creator
Mar 12, 2021
In Coding with Velo
Hey guys, I am trying to to use google cloud mysql instance as an external database. I am following this guide but I am stuck at the "Deploying to Cloud Run using Cloud Console" section. I get this error: Image 'gcr.io/corvid-api/mysql-connector-node' not found. any help? Thanks
External Database Adapter for MySQL content media
0
1
45
Ziv Assor
Content Creator
Content Creator
Sep 20, 2020
In Tips, Tutorials, Examples
Hi everyone, here is a tutorial for how to export data collection to excel file using code. To use this tutorial you need: 1) Install the package: "xlsx" 2) Button element 3) html element 4) web module - I called it excel.jsw After installing the xlsx package, use this code for each element: excel.jsw const XLSX = require('xlsx'); export function exportExcel(worksheet) { var wb = XLSX.utils.book_new(); var ws_name = "SheetJS"; /* make worksheet */ var ws_data = worksheet; var ws = XLSX.utils.aoa_to_sheet(ws_data); /* Add the worksheet to the workbook */     XLSX.utils.book_append_sheet(wb, ws, ws_name); return wb; } export function createAoA(rowNum,colNum) { //crete array of array for the excel export var x = new Array(rowNum); for (var i = 0; i < x.length; i++) {   x[i] = new Array(colNum); for (var j = 0; j < colNum; j++) {       x[i][j]=0;   } } return x; } Button element (I called it iconButton2) - this is the code for the web page import { exportExcel } from 'backend/excel'; import { createAoA } from 'backend/excel'; import wixData from 'wix-data'; $w.onReady(function () { // TODO: write your page related code here... }); export async function iconButton2_click(event) {     wixData.query("payments") //change "payments" to your own collection name         .find()         .then((results) => { if (results.items.length > 0) {                 console.log(results); let colNum = Object.keys(results.items[0]).length; let rowsNum = results.items.length;                 createAoA(rowsNum, colNum).then(result2 => { for (var i = 0; i < rowsNum; i++) {                         result2[i] = Object.values(results.items[i]);                     }                     console.log(result2, "result 2");                     exportExcel(result2).then((excelfile) => {                         console.log(excelfile, "excelfile");                         $w('#html1').postMessage(excelfile);                     })                 });             } else {                 console.log("can't fint items");             }         })         .catch((err) => { let errorMsg = err;         }); } html element <!DOCTYPE html> <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.16.7/xlsx.js" integrity="sha512-fH2nbzuBSxkg1hpGKgSGlTcI5GQuqzaPTg04xY/W7UE6X8I+UENvr6qrlvX/G2NK7+acVkBznP1qefpMvNfP7A==" crossorigin="anonymous"></script> </head> <body> <script> var wb = XLSX.utils.book_new(); var ws_name = "SheetJS"; /* make worksheet */ var ws_data = [         ["S", "h", "e", "e", "t", "J", "S"],         [1, 2, 3, 4, 5],     [5,4,3,2,1]     ]; var ws = XLSX.utils.aoa_to_sheet(ws_data); /* Add the worksheet to the workbook */     XLSX.utils.book_append_sheet(wb, ws, ws_name); console.log(wb); function myFunction(filewb) {     XLSX.writeFile(filewb, 'out.xls'); } window.onmessage = function(event){ if (event.data) {       wb = event.data;       console.log(wb,"wb");     } else {       console.log("if error");     }   }; </script> <button onclick="myFunction(wb)">export to excel</button> </body> </html> let me know if you have any questions. Enjoy :) 😎
Export data collection to XLS excel file using code content media
9
84
3k
Ziv Assor
Content Creator
Content Creator
Sep 05, 2020
In Coding with Velo
Hi, I need to create a new collection when some event is occurring. Any ideas? Thanks
0
3
31
Ziv Assor
Content Creator
Content Creator
May 20, 2020
In Tips, Tutorials, Examples
Hi guys, here is an easy way to let visitors export data to excel (csv file), include Hebrew. What you need is: 1) Create dataset for the collection you want to export 2) iFrame element Button click code: export async function button1_click(event) { await $w("#dataset1").onReady( () => { } ); let totalcount = $w("#dataset1").getTotalCount()-1; //find matrix number of rows let itemObj = $w("#dataset1").getCurrentItem();  let colNum = Object.keys(itemObj).length; //find matrix number of column var matrix = []; //define the matrix for(var k=0; k<totalcount; k++) {         matrix[k] = new Array(colNum).fill(0);     } let result =await $w("#dataset1").getItems(0,totalcount); let items = result.items; for (var j = 0; j < totalcount; j++) {  let arr = Object.values(items[j]); for (var i = 0; i < arr.length; i++) {             matrix[j][i]=arr[i];         }     }    $w('#html1').postMessage(matrix); } iFrame code (just copy-paste) <html> <head> <script type="text/javascript"> var Results = []; window.onmessage = function(event){ if (event.data) { let receivedData = event.data; Results =receivedData; } else { console.log("if error"); } }; exportToCsv = function() { var CsvString = ""; Results.forEach(function(RowItem, RowIndex) { RowItem.forEach(function(ColItem, ColIndex) { CsvString += ColItem + ','; }); CsvString += "\r\n"; }); CsvString = "data:text/csv;charset=utf-8,%EF%BB%BF" + encodeURIComponent(CsvString); var x = document.createElement("A"); x.setAttribute("href", CsvString ); x.setAttribute("download","somedata.csv"); document.body.appendChild(x); x.click(); } </script> </head> <body> <button onclick="exportToCsv()">export to CSV</button> </body> </html> Let me know if you have any questions :)
1
1
391
Ziv Assor
Content Creator
Content Creator
May 13, 2020
In Coding with Velo
Hi, I want to import data from excel file that the user is uploading to a collection. Any ideas on how to do that?
0
9
1k
Ziv Assor
Content Creator
Content Creator
May 07, 2020
In Coding with Velo
Hi, I am using the File Share App. I some folder that include sub folders. How can I upload the entire folders? Can I use Wix some code? Thanks
0
1
78
Ziv Assor
Content Creator
Content Creator
Sep 14, 2019
In Coding with Velo
Hi, I want to create a form (10 questions - each should be rate from 1 to 5). I am using a repeater to display the question from the questions dataset. Now, I am adding radio buttons so the user can choose between 1 to 5. How can I store the answer? If am connecting the radio buttons to a dataset only the first one stored. Thanks
0
3
461

Ziv Assor

Content Creator
+4
More actions
bottom of page