# Erase one various fields once in customer register

**URL:** <https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746>\
**Category:** Version 4\
**Created:** [July 21, 2016, 3:25pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746 "2016-07-21T15:25:31Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cinema](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@Cinema](https://forum.sambapos.com/u/Cinema)\
**Post date:** [July 21, 2016, 3:25pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/1 "2016-07-21T15:25:31Z")

</div>

Hello guys  
Please help me

 ![](https://forum.sambapos.com/uploads/default/original/3X/a/8/a8095ec53a22816e0c8398ac48cffe53124df962.png)

Excuse me but  
my English is not very good

now I need other help

I need to create a way to delete a specific field of all clients at once

it’s possible?

I bought version 5 but I am still using version 4

as I am new to sambapos

We have a PUP and did sambapos work with electronic commanding

how to solve this?

Best Regards

---

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [July 21, 2016, 6:53pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/2 "2016-07-21T18:53:27Z")

</div>

You want to delete the field or the value in it?

---

<div class="post-metadata">

**Author:** ![Cinema](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@Cinema](https://forum.sambapos.com/u/Cinema)\
**Post date:** [July 21, 2016, 8:03pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/3 "2016-07-21T20:03:04Z")

</div>

the value  
but all files  
Can you help me

---

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [July 21, 2016, 8:31pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/4 "2016-07-21T20:31:12Z")

</div>

Files?

Batch entity editor probably the simplest way, how many entities you have?

![](https://forum.sambapos.com/uploads/default/original/3X/8/4/84da65dbfb4f86504c20f34d50e4123ce7d08d65.png)

You can just do;

Down  
Delete  
Down  
Delete  
Down  
Delete  
Down  
Delete  
ETC ETC ETC

You could setup a loop value automation but bit over the top if its a one of.  
V5 you could script something but again if its a one of and not 1000’s of entities easier just to use bulk entity editor.

---

<div class="post-metadata">

**Author:** ![Cinema](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@Cinema](https://forum.sambapos.com/u/Cinema)\
**Post date:** [September 5, 2016, 6:07pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/5 "2016-09-05T18:07:25Z")

</div>

I want to delete only the value.  
I need to clear the field value  
But of all the files at once

I do not understand programming  
But they told me that could create a script  
that would solve the problem

Can you help me?

---

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [September 5, 2016, 7:08pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/6 "2016-09-05T19:08:34Z")

</div>

Depends on how many enties your talking, a script is not a 2-3 minute job, entity data is stored in json within sql so would need to use included handlers/parse json in a jscript, if it was column per field SQL query would be fairly simple but not the case for custom fields.  
If your only talking a 10’s or couple of hundred its will probably be quicker just to do manually in batch editor as above.  
**Oh and also scripts not available in V4 🙂**

---

<div class="post-metadata">

**Author:** ![Cinema](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@Cinema](https://forum.sambapos.com/u/Cinema)\
**Post date:** [September 5, 2016, 7:26pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/7 "2016-09-05T19:26:26Z")

</div>

> [@JTRTech](#):
>
> Depends on how many enties your talking, a script is not a 2-3 minute job, entity data is stored in json within sql so would need to use included handlers/parse json in a jscript, if it was column per field SQL query would be fairly simple but not the case for custom fields.If your only talking a 10’s or couple of hundred its will probably be quicker just to do manually in batch editor as above.Oh and also scripts not available in V4

OK  
BUT I HAVE LICENSED VERSION 5  
HOW TO SCRIPT?  
TO SOLVE THIS PROBLEM

---

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [September 5, 2016, 7:34pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/8 "2016-09-05T19:34:57Z")

</div>

NO NEED TO SHOUT!! YOU POSTING IN V4 SECTION OF THE FORUM 😛

You need to call a list of entities for the entity type, then for loop thorough them updating the data field to blank.  
Youll also need an entity count to set the number of loops in the for loop.

Not sure if there are helpers/easier way for getting the list or loop, my system used SQL queries for the list and count.

SQL function for entity count;

```
function sqlEntityCount(inputEntityType) { //--Entity count by entity type
	qry = " SELECT COUNT([Name]) as [CT] ";
	qry += " FROM [Entities] ";
	qry += " WHERE [EntityTypeId]= ";
	qry += " ( ";
	qry += " SELECT [Id] ";
	qry += " FROM [EntityTypes] ";
	qry += " WHERE [Name]='"+inputEntityType+"' ";
	qry += " ) "; //--QRY Variable + 'roomEntityType' Variable
	var entityCount = sql.Query(qry).First; //--SQL Query responce -> entityCount Variable
	return entityCount; //--Return
}

```

SQL for entity list;

```
function sqlEntityList(inputEntityType) { //--Entity list by entity type
	qry = " SELECT [Name] ";
	qry += " FROM [Entities] ";
	qry += " WHERE [EntityTypeId]= ";
	qry += " ( ";
	qry += " SELECT [Id] ";
	qry += " FROM [EntityTypes] ";
	qry += " WHERE [Name]='"+inputEntityType+"'	";
	qry += " ) ";
	qry += " ORDER BY [Name] "; //--QRY Variable + 'roomEntityType' Variable
	var entityList = sql.Query(qry).Delimit('~').All; //--SQL Query responce -> entitiesList Variable (~ seperated list of entities)
	return entityList; //--Return
}

```

Define the count and list as variables;

```
	var entityCount = sqlEntityCount( ***ENTITYTYPE*** ); //--SQL Query responce -> entityCount Variable
	var entityList = sqlEntityList( ***ENTITYTYPE*** ); //--SQL Query responce -> entities Variable (comma seperated list of entities)

```

Use this loop to cycle through entities;

`for (var e = 0; e<entityCount; e++) {`

Within the loop define the ‘loop entity’ like this;

`var loopRoomName = entityList[e];`

Use the entity data helper to clear the value;

`api.Entity(loopRoomName).Data( ***FieldName*** ).Update('');`

You obviously need to set the ` ***FieldName*** ` and ` ***ENTITYTYPE*** ` value - it will be in quotes if a static string.

---

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [September 5, 2016, 7:40pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/9 "2016-09-05T19:40:00Z")

</div>

Resulting in something like this;

```
function clearEntityDataFields(entityType,entityField) {
  var entityCount = sqlEntityCount(entityType);
  var entityList = sqlEntityList(entityType);
  var loopRoomName = '';
  for (var e = 0; e<entityCount; e++) {
  var loopRoomName = entityList[e];
  api.Entity(loopRoomName).Data(entityField).Update('');
  }
  return 'Done'
}

function sqlEntityCount(inputEntityType) {								
	qry = " SELECT COUNT([Name]) as [CT] ";
	qry += " FROM [Entities] ";
	qry += " WHERE [EntityTypeId]= ";
	qry += " ( ";
	qry += " SELECT [Id] ";
	qry += " FROM [EntityTypes] ";
	qry += " WHERE [Name]='"+inputEntityType+"' ";
	qry += " ) ";	
	var entityCount = sql.Query(qry).First;		
	return entityCount;		
}

function sqlEntityList(inputEntityType) {		
	qry = " SELECT [Name] ";
	qry += " FROM [Entities] ";
	qry += " WHERE [EntityTypeId]= ";
	qry += " ( ";
	qry += " SELECT [Id] ";
	qry += " FROM [EntityTypes] ";
	qry += " WHERE [Name]='"+inputEntityType+"'	";
	qry += " ) ";
	qry += " ORDER BY [Name] ";		
	var entityList = sql.Query(qry).Delimit('~').All;
	return entityList;
}

```

Which you would run using function `clearEntityDataFields(' ***ENTITYTYPE***',' ***FieldName***')`  
You would need to add the handler if running outside of the script window using the test field.

---

<div class="post-metadata">

**Author:** ![Cinema](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@Cinema](https://forum.sambapos.com/u/Cinema)\
**Post date:** [January 26, 2017, 12:18pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/10 "2017-01-26T12:18:39Z")

</div>

thank you friend…  
As always  
Very helpful

---

<div class="post-metadata">

**Author:** ![Cinema](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@Cinema](https://forum.sambapos.com/u/Cinema)\
**Post date:** [January 26, 2017, 1:02pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/11 "2017-01-26T13:02:14Z")

</div>

Hi friend…  
I need help

I added a self-service to my business  
And I wanted to know if it’s possible mine weighing-machine  
Weigh food Automatically send the weight of the food to the program  
Without having to type on the numeric keypad

I do not know how to do this procedure.  
To send the command to the scale and she responds with the weight of the food

MY PRINTER IS TOLEDO 3 PLUS  
My printer is Ttoledo 3 Plus

Your manual says it is necessary to use a communication protocol  
To obtain the balance weight.

The application sends to the balance via the serial port:  
[ENQ]

The printer responds:  
[STX][ppppp][ETX] or [STX][I I I I I][ETX] or [STX][NNNNN][ETX] or [STX][SSSSS][ETX]

Where:  
[STX]=character ASCII (02 H);

[Ppppp] = Weight field consisting of 5 ASCII characters, the first two characters being relative to the whole part of the And the other three to the decimal part. All zeros on the left should exist;

[I I I I I] = 5 ASCII characters (49 H) representing unstable weight;  
[NNNNN] = 5 ASCII characters (4E H) representing negative weight;  
[SSSSS] = 5 ASCII characters (53 H) representing weight overload.  
[ETX] = ASCII character (03 H).  
Example: 14.385 (14 kilograms and 385 grams).  
[STX] [14385] [ETX]

I have to create some kind of script for the two to communicate

If you can help me, I would appreciate it.  
A friend hug  
Edson

 ![](https://forum.sambapos.com/uploads/default/original/3X/4/0/40767eeebd075ddb1ab66070b9e3ab13285e6201.png)

---

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [January 26, 2017, 2:49pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/12 "2017-01-26T14:49:19Z")

</div>

Maybe try looking on the forum;

> [@\[New 4.1.4\] Scale Integration](https://forum.sambapos.com/t/new-4-1-4-scale-integration/118):
>
> You can connect scales to SambaPOS by configuring a scale from Management \> Local Settings \> Devices My Scale is CAS ER model. To configure port click Settings and choose the port your device is connected to. [image] When a scale connected, scaling automatically updates Number Pad value. So when you add a product quantity value becomes scaled value. Custom Scale If your scale does not listed here you can try integrating it by using “Custom Scale” option. To be able to …

---

<div class="post-metadata">

**Author:** ![Cinema](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@Cinema](https://forum.sambapos.com/u/Cinema)\
**Post date:** [January 30, 2017, 5:03pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/13 "2017-01-30T17:03:13Z")

</div>

thank you friend…  
As always  
Very helpful

The Brazil sends you a hug

---

<div class="post-metadata">

**Author:** ![Cinema](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/c/5daacb/32.png) [@Cinema](https://forum.sambapos.com/u/Cinema)\
**Post date:** [February 1, 2017, 12:49pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/14 "2017-02-01T12:49:16Z")

</div>

Hi! my Friend

I want to split the bill from the table.

In 2 or more people and print in ticket

I found a topic related to this but did not work

> [@Some questions sambapos4](https://forum.sambapos.com/t/some-questions-sambapos4/185/11):
>
> Yes we’ll print on bill. What I’m trying to understand is how would you like operator use this feature because there are more than one solution. Let me give an example. (Test it with [4.1.15](http://sambapos.com/downloads) release) I’ve added this line to bill template. [\<J10\>Payment By Guest:|[=F(TN('{TICKET TOTAL}') / TN('{SETTING:NUMBERPAD}'))]] It reads numberpad value and prints ticket total divided by that value. So if there are two couples you can enter 2 and Print Bill button. This is what it …

When I add the command

{DISCOUNTS}  
[Total Gift:|{ORDER STATE TOTAL:Gift}]  
[Payment By Guest:|[=F(TN(‘{TICKET TOTAL}’) / TN(‘{SETTING:NUMBERPAD}’))]]

On the ticket so displays

* * *

## BAR E RESTAURANTE PIERROT

## Data:01/02/2017 Hora:10:42 Mesa: S-05

- 1 Aipim Frito 16,00
- 1 Fanta Laranja Lat 4,00
- 1 File de Tilapia 54,90
- 1 Carangueijo 6,90
- 1 Camarao VG 79,00  
==============================  
Sub-Total:  
Payment By Guest: +Infinito \<\<\<\<\<=============== this is the problem  
Total: R$ 160,80  
==============================
  - OBRIGADO POR VIR \*
  - THANK YOU FOR COMMING \*
    - GRACIAS POR VENIR \*

* * *

```
  * CUPOM NÃO FISCAL *

```

OBS: Displays the word infinity, not the total divided

CAN YOU HELP ME

THANK YOU MY FRIEND…

---

<div class="post-metadata">

**Author:** ![JTRTech](https://forum.sambapos.com/user_avatar/forum.sambapos.com/jtrtech/32/21270_2.png) [@JTRTech](https://forum.sambapos.com/u/JTRTech)\
**Post date:** [February 1, 2017, 10:41pm UTC](https://forum.sambapos.com/t/erase-one-various-fields-once-in-customer-register/11746/15 "2017-02-01T22:41:38Z")

</div>

You might be better to impliment a ticket covers setup using say tag and use the tag to divide for the split.  
Even if it is only on a specific split bill print button.  
Something strong like a tag would be more reliable than trying to use number pad directly.

How are you specifying of its a split bill or not in order to show a split amount value?

Something simple like a [?prompt] expression to set the tag before printing would suffice and would mean the value would remain for further prints…
