List of a badge scans

Hi
Hope this is the right place where post my question…
I need to create a screen in AppInventor that scans and stores every QRcode data in google spreadsheets.
We built this program with a QR-Scan. The scan sends the information in qr code to google spreadsheet that stores the information during the season.

Yuri arrives —> scans his badge —>time in /date in —>Yuri goes away—>scans his badge—>time out/date out
Sarah arrives—>[the same process]
And so on for many volunteer every day and every months

All these informations will stock into one googlesheets

464019901_577762
this sequence doesn’t work because the program doesn’t send and stock to google the information scanned.


This sequence, instead, sends and stocks the information but when the same QRcode is scanned three(or multiple) time, it overlays the old information.
So i need the informations don’t overlay but pile up in a big list where, for example,
Yuri and Sarah appear many days in a months (with date and hours in and out)

Thanks for your help

Please provide your google apps script code.

Why two barcodescanners ?

Hi, it almost same like my process. What can I advice you need to create an unique I.d number for every person, so when scanner detected which i.d it can send data to specific column and row in google form.

Regards

2 scanner probably for Punch IN and Punch OUT.

Regards

The problem isn’t scan iN and Out. Is that when you scan “your” code the third time… Your data (in your code/badge) overlay the old data instead of create a big list with every scan (in /out) of your code during the year

The code is personal.
Every volunteer have a unique code and the volunteers have to scan their code.
But using the second picture (with that program), it’s possible to save 2 scans for person. At the third scan for the same person, the scan overlay first the data in IN space scan and at the fourth scan, the data replace the data into OUT space

We don’t know how create a repetition of the second program during the days to obtain a list with all volunteer’s scans
Day 1 sarah IN/OUT + John IN/OUT + Alice IN/OUT
Day 2 Sarah IN/OUT + Alice IN/OUT
Day 3 Alice IN/OUT + John IN/OUT

In my problematic program when Sarah scan the third time, the scan transcribe the data in "Day 1"line instead to create a new line for Day 2

The barcode is one and unique per person.
We don’t know how to do a loop during the days to all scans per person. because the third and the fourth scan overwrites the first and Second scan saved on google sheets (using the program in The second picture). Instead i need to create a list with every day and each person per day

Without seeing the apps script code, this is more or less impossible to identify the problem!

https://script.google.com/d/1KxMn-qNPnLTLFjLEzp5sw12PwLrfLuk-NzQYA-Q1RaF5whBCxgFyaYqC/edit?usp=drivesdk

I’m sorry! 'Cause i’m only a link between my developer and this forum so i ignore many words and concepts. Hope this link is what you need to understand our problems

Thank you so much

Can’t access that link - just post the code here

function doGet(e){
  var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/10wdQMDTJe2gVE6KVjuCSPbr79R9G8fyjdTE11Ds6M68/edit#gid=0");
  //Give your Sheet name here
  var sheet = ss.getSheetByName("Sheet1");

  insert(e,sheet);

}

function doPost(e){
  var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/10wdQMDTJe2gVE6KVjuCSPbr79R9G8fyjdTE11Ds6M68/edit#gid=0");
  //Give your Sheet name here
  var sheet = ss.getSheetByName("Sheet1");

  insert(e,sheet);

}



function insert(e,sheet){
 
  // reciving scanned data from client i.e android app
  var sdata = e.parameter.sdata;
  
  var date = new Date()
  
  sheet.appendRow([date,sdata]);
  
}

That looks OK :slight_smile: I cannot see why you can be overwriting data on the spreadsheet (are you ?)

You are however showing different parameters in the blocks you have posted. For the script:

?sdata=barcodeoutput

for the blocks

?action=in&id=barcodeoutput

You will need to change your script for this, and republish with new version

Got to be in your blocks somewhere …

hi i’m a co-worker about this project, @TIMAI2 the scipt sended by @Ev_Boc it’s about the first block image sended (the app who doesn’t work).
for the second app, where we would like can saved more data about INTIME and OUTTIME, the script is that

var ss = SpreadsheetApp.openByUrl(“https://docs.google.com/spreadsheets/d/1btQMi2pAH9lLMlTThnjoLutxMBSwyi5711KcgG2QKnc/edit#gid=0”);
var sheet = ss.getSheetByName(“daily_attendance”);

function doGet(e){
var action = e.parameter.action;

if(action == “in”)
return inTime(e);

if(action == “out”)
return outTime(e);

}

function doPost(e){
var action = e.parameter.action;

if(action == “in”)
return inTime(e);

if(action == “out”)
return outTime(e);

}

function inTime(e){
var id = e.parameter.id;
var values = sheet.getRange(2,1,sheet.getLastRow(),1).getValues();

for(var i = 0 ; i<values.length ; i++){
if(values[i][0] == id){
i=i+2;
var in_time = Utilities.formatDate(new Date(), “IST”, “HH:mm:ss”);
sheet.getRange(i,3).setValue(in_time);
return ContentService.createTextOutput("Thank You ! Your In Time is "+in_time).setMimeType(ContentService.MimeType.TEXT);
}
}
return ContentService.createTextOutput(“Id Not Found”).setMimeType(ContentService.MimeType.TEXT);
}

function outTime(e){
var id = e.parameter.id;
var values = sheet.getRange(2,1,sheet.getLastRow(),1).getValues();

for(var i = 0 ; i<values.length ; i++){
if(values[i][0] == id){
i=i+2;
var out_time = Utilities.formatDate(new Date(), “IST”, “HH:mm:ss”);
sheet.getRange(i,4).setValue(out_time);
return ContentService.createTextOutput("Thank You ! Your Out Time is "+out_time).setMimeType(ContentService.MimeType.TEXT);
}
}
return ContentService.createTextOutput(“Id Not Found”).setMimeType(ContentService.MimeType.TEXT);
}

we wold like can save more data in the spreadsheet, because now this program the intime and outtime about one day, if the second day i scan the barcode the intime and outtime of the day before are overwrited.

You do not appear to be appending ANY data to the spreadsheet in the second script ?

I think you need an else {} in the if statement in your two functions inTime and outTime for this part:

} else {
return ContentService.createTextOutput(“Id Not Found”).setMimeType(ContentService.MimeType.TEXT);
}

I would recommend that you simplify, get the appending of simple data working correctly, then build your solution

sorry, i didn’t understand
(we are not experts)

Bonjour. j'ai essayé le script pour essayer de créer une application qui enregistre l'arrivée et celle de sortie. j'utilise le script mais il y a une erreur. voici l'erreur: TypeError: Impossible de lire la propriété 'paramètre' d'undefined (ligne 5, fichier "Code")

Are you sending a parameter "action=in" or "action=out" in your url ?

oui mais toujours pas de reponse. la reponse que j'ai c'est : Le script est terminé mais aucune réponse n'a été obtenue.

Hello, I am coming to ask for help. your script worked normally. thank you very much.
Now I am trying to create a Shhet table in which there will be 3 Columns.
Column A: Customer names, Column B: Time date, Column C: Number of visits.
Once the customer's QR code is scanned, the date on which the customer visited is added in Column B (Date time) and in column C: Number of visits, we add the number of his visits. Suppose the customer comes 3 times. So in column C (Number of visits we will have 3). If you can help me with this please. thank you very much

1 Like