# How does the SETTING functionality actually work

**URL:** <https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074>\
**Category:** V5 Question\
**Created:** [August 22, 2018, 9:57am UTC](https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074 "2018-08-22T09:57:33Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![GreatShakesBar](https://forum.sambapos.com/user_avatar/forum.sambapos.com/greatshakesbar/32/50947_2.png) [@GreatShakesBar](https://forum.sambapos.com/u/GreatShakesBar)\
**Post date:** [August 22, 2018, 9:57am UTC](https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074/1 "2018-08-22T09:57:33Z")

</div>

Is it permanantely stored, or does it always reset after a work period/reboot?

Asking because ive just created a department change depending on time, and it uses SETTING and Trigger… example

7am Trigger makes {SETTING:bar} to AM  
7pm Trigger makes {SETTING:bar} to PM

then department changes depending on what that setting is set to on User login

Just wondering if I close the work period today, do the triggers still activate, or even will the Settings still have either AM or PM in them?

Cheers

Matt

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [August 22, 2018, 12:33pm UTC](https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074/2 "2018-08-22T12:33:02Z")

</div>

Global Settings are permanently stored. Local Settings are lost when you shut down SambaPOS. You can delete both types of settings by using “Update Setting” action with “Delete” parameter enabled from “Update Type”.

For V5 reading a local setting with `{LOCAL SETTING:x}` tag and reading a global setting with `{GLOBAL SETTING:x}` is more efficient.

Using `{CSETTING:x}` greatly improves speed for global settings. It reads value once from database and does not read anymore until cache cleared. Useful if you have settings does not change too frequently.

---

<div class="post-metadata">

**Author:** ![GreatShakesBar](https://forum.sambapos.com/user_avatar/forum.sambapos.com/greatshakesbar/32/50947_2.png) [@GreatShakesBar](https://forum.sambapos.com/u/GreatShakesBar)\
**Post date:** [August 22, 2018, 12:48pm UTC](https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074/3 "2018-08-22T12:48:04Z")

</div>

ooh, new to me that.

ill change some bits

thanks

matt

---

<div class="post-metadata">

**Author:** ![GreatShakesBar](https://forum.sambapos.com/user_avatar/forum.sambapos.com/greatshakesbar/32/50947_2.png) [@GreatShakesBar](https://forum.sambapos.com/u/GreatShakesBar)\
**Post date:** [August 22, 2018, 1:30pm UTC](https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074/4 "2018-08-22T13:30:05Z")

</div>

can I just confirm, if I set a {GLOBAL SETTING:} it can still be read using {LOCAL SETTING:} and {:CSETTING} and {:SETTING}

cheers

Matt

---

<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:** [August 22, 2018, 2:12pm UTC](https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074/5 "2018-08-22T14:12:54Z")

</div>

Global settings are stored in DB, local in cache.  
Global are indefinite, local are cleared either with pc restart - posibly samba restart.  
Specifying global or local as far as I understand should be specific but I believe just {SETTING:XXX} checks local first before global for matching setting name. Emre may correct this but that’s my understanding.  
Never seen csetting

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [August 22, 2018, 3:45pm UTC](https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074/6 "2018-08-22T15:45:33Z")

</div>

- {GLOBAL SETTING} reads global settings.
- {LOCAL SETTING} reads local settings.
- {SETTING} and {CSETTING} reads both. However they are slower as they need to scan settings to determine if they are local or global.

Global settings are stored on database so accessible from other terminals. Global settings are persistent. Does not gets lost until they are deleted.

Local settings stored in local application memory. Not accessible from other terminals. Got lost when SambaPOS restarts.

---

<div class="post-metadata">

**Author:** ![GreatShakesBar](https://forum.sambapos.com/user_avatar/forum.sambapos.com/greatshakesbar/32/50947_2.png) [@GreatShakesBar](https://forum.sambapos.com/u/GreatShakesBar)\
**Post date:** [August 22, 2018, 9:45pm UTC](https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074/7 "2018-08-22T21:45:28Z")

</div>

Excellent thanks.

This has created a whole new ball game for me… my head is going wild with ideas lol.

Just got to do some edits in my latest screen switching system.

Thanks for the help appreciate it

Matt

---

<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:** [August 22, 2018, 10:35pm UTC](https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074/8 "2018-08-22T22:35:53Z")

</div>

Program serttings seemed like the greatest thing when first cracked the principle but see them get used for allot of things that would be more suitable as say a ticket state or tag and entity state or custom field or even ‘live’ with a good report expression.

Two things I have which are good examples of each are;  
Last ticket ID for print last bill. As a local setting so per terminal reprint option. I like this one as worked state mappings for normal print bill and print last bill so the two buttons fill the sale position with print last available untill a ticket is opened then it prints that current ticket.  
On my origional hold ticket setup I used global program settings using username and increasing/decreasing as tickets are put on hold/opened, using global so count is maintained over all tills. This has since been replaced with a report expression to check for ticket state of hold with state value of that username so on login it prompts them to remind them they have tickets on hold.

---

<div class="post-metadata">

**Author:** ![GreatShakesBar](https://forum.sambapos.com/user_avatar/forum.sambapos.com/greatshakesbar/32/50947_2.png) [@GreatShakesBar](https://forum.sambapos.com/u/GreatShakesBar)\
**Post date:** [August 24, 2018, 2:23pm UTC](https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074/9 "2018-08-24T14:23:18Z")

</div>

so in my screen change dependant on time, ive changed it all to, for example, {GLOBAL SETTING:bar} from {SETTING:bar} and set the ‘is local’ to false in the setting action.

But it doesn’t display anything, I have a button that should toggle but its blank… and with the setting not working it makes a few other things not work ive set up…  
am I using it right?

do I need {GLOBAL SETTING} if I changed the ‘is local’ to false?

Matt

---

<div class="post-metadata">

**Author:** ![emre](https://forum.sambapos.com/user_avatar/forum.sambapos.com/emre/32/39073_2.png) [@emre](https://forum.sambapos.com/u/emre)\
**Post date:** [August 24, 2018, 2:29pm UTC](https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074/10 "2018-08-24T14:29:14Z")

</div>

Sorry I couldn’t understand what you are asking. {SETTING} will work for all types of settings.

---

<div class="post-metadata">

**Author:** ![GreatShakesBar](https://forum.sambapos.com/user_avatar/forum.sambapos.com/greatshakesbar/32/50947_2.png) [@GreatShakesBar](https://forum.sambapos.com/u/GreatShakesBar)\
**Post date:** [August 24, 2018, 2:30pm UTC](https://forum.sambapos.com/t/how-does-the-setting-functionality-actually-work/18074/11 "2018-08-24T14:30:58Z")

</div>

yep, my bad… I set all constraints so that it was impossible for me to set the first {SETTING} and so then everything else wasn’t working… doh

Whoops 😃
