App for CSA

Hiya, all - loving the idea of fast prototyping with Glide, as well as being able to put concepts into the wild/production with record speed. Brave new world!

I currently belong to a CSA (community supported agriculture) which delivers amazing products to my home. However, it’s all over text messages for orders and recently introduced Google Forms for letting them know your preferences (how many eggs, kale, lettuce, etc).

This is clunky at best, and after learning about Glide, it gives me a great excuse to learn the tool and build something to improve my experience, the community, and the small business.

The basics of how this would work is that users make selections during the week and they prep and deliver orders on Monday (based on what’s available).

I’ve got it to where individuals can log in, have user preferences, as well as build their own product “basket.” My concern is that the setup feels brittle because it’s dependent on a couple arrayFormula functions where data would get corrupted if a parent list is reordered.

Here’s the app:

Here’s the spreadsheet with comment access:

I’m thinking that perhaps doing some scripting would mean more robustness.

Feedback welcome!

1 Like

You are correct in the fact that by using that Arrayformula, =ARRAYFORMULA(‘App: Logins’!B2:B), on the Users sheet you could have an issue going forward. Also if a person runs the app on two devices you would have multiple logins on the Logins sheet for the same email. You could solve that by applying a UNIQUE formula but you still may have issues and would never be able to sort anything on the users page. It would be better to have users create their own user row by using a Form button, maybe on the Home screen. You would save the results to the Users sheet. You would not need to ask for their email as you would have that in a “Special Values” field. No need for a script to do that.
I did give it a try and can’t figure out how you move the items that I selected on the basket page over to an actual order page. Am I missing something? Since I don’t speak or read Spanish it’s a bit hard for me to follow, but I couldn’t see a way.

One other general comment is that currently writing a shopping cart / e-commerce style of application using Glide, especially without code, would be rather difficult in my opinion at this point in the Glide development cycle. I’m not saying it’s impossible but I would think that you would need some amount of scripting running behind the scenes.

This is a script that I use to copy names from one sheet to 3 others. It’s a copied script that I found on the web and modified until it worked for me, so I don’t really have great details on how it works, but essentially I have a primary sheet with names. Whenever there is a new name added, the script will run automatically, check the 3 other sheets if the name exists, then add it to the next empty row if it does not already exists. It should work for sure as long as the value you want copied over is in the first column. I use the first 2 rows as header rows, so I only check values from row 3 and below and apply to rows 3 and below. That can be changed in the script to look at row 2 and below if you choose.

  // You can activate a trigger on function copy_new_names()
    // Assuming that row 1 and 2 in each sheet is not included in the values to be processed...

    function CopyName() {
    var SheetID = 'your spreadsheet ID here'
   // Enter the From sheet name and To sheet name)
    copy_new_names('LTS_Students', 'LTS_Tests', SheetID);
    copy_new_names('Advanced_Students', 'Moves_Tests', SheetID);
    copy_new_names('Advanced_Students', 'FreeStyle_Tests', SheetID);
    copy_new_names('Advanced_Students', 'Dance_Tests', SheetID);
    // copy_new_names('Advanced_Students', 'Add_Competition', SheetID);

    function copy_new_names(SheetFrom, SheetTo, SheetID) {
      var spreadsheet = SpreadsheetApp.openById(SheetID);
      var sheet = spreadsheet.getSheetByName(SheetFrom);
      var sheet2 = spreadsheet.getSheetByName(SheetTo);
      var endrow = sheet.getLastRow(), endcol = sheet.getLastColumn();
      var endrow2 = sheet2.getLastRow(), endcol2 = sheet2.getLastColumn();
      // assuming that row 1 and 2 is not included in the values to be processed
      var valuesSheet1 = sheet.getRange(3, 1, endrow-2, 1).getValues(), valuesSheet2 = [];
      if ( endrow2 > 2 ) valuesSheet2 = sheet2.getRange(3, 1, endrow2-2, 1).getValues();
      valuesSheet2 = [i for each (i in valuesSheet2)if ((i)[0].trim()!="")];

      var newlist = checkNameList(valuesSheet1, valuesSheet2);
      //Below to paste new list in sheet2 
      sheet2.getRange(3, 1, newlist.length, 1).setValues(newlist);

    function checkNameList(valuesSheet1, valuesSheet2) {
      var values1 = { return d.join()}), values2 = [];
      if ( valuesSheet2.length ) values2 = { return d.join()});
      var newList = [];
        for ( var i in values1 ) {
          if ( values2.indexOf(values1[i]) === -1 && values1[i].length>0) newList.push([values1[i]]);
      newList = valuesSheet2.concat(newList);
      return newList;

@George_B - ahhh. Good point on the multiple logins issue and potentially using a form for that. The other way might be to just whitelist emails for users.

To your point on moving items, I was not able to do that either in an “e-commerce” fashion where you add items to your “Basket” - so, in this case, the “Products” tab serves as a place to look around at items, and then you have to go into your “Basket” to configure what you want your weekly delivery to be.

It would be great if someone could move/copy an item from the Products table into another sheet with a button, but I wasn’t able to figure that out (yet?).

Agreed that full-ecommerce is hard with Glide as it stands. Especially a concept like the one I’m building here which is even more difficult because it’s a dynamic subscription service that not even Shopify + off-the-shelf apps can address. So, at this point it’s a “communication tool” which users/customers can use to tell the business what their preferences are.

@Jeff_Hager - great! Thank you for that. I’ll check it out.

p.s. translated the app to English for now so it’s easier to play with :).