# How can I get it MID() formula to show part of info before saving?

**URL:** https://community.glideapps.com/t/how-can-i-get-it-mid-formula-to-show-part-of-info-before-saving/26872
**Category:** Ask for Help
**Created:** [May 17, 2021, 2:14pm UTC](https://community.glideapps.com/t/how-can-i-get-it-mid-formula-to-show-part-of-info-before-saving/26872 "2021-05-17T14:14:34Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Alexandre\_Caruso](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/alexandre_caruso/32/6240_2.png) [@Alexandre\_Caruso](https://community.glideapps.com/u/Alexandre_Caruso)
#### Post date: [May 17, 2021, 2:14pm UTC](https://community.glideapps.com/t/how-can-i-get-it-mid-formula-to-show-part-of-info-before-saving/26872/1 "2021-05-17T14:14:34Z")

</div>

My user insert a hash or a sequence of 48 digits.  
For example 846900000015259602962021103150630004002081451896

using this formula after saved value(MID(A1103;5;7)&mid(A1103;13;2)&","&mid(A1103;15;2)) get the amount of this bill R$125,96

826500000011699901066406457784431910522700000006

in this R$169,99

I´d like to check before save, if the user entry the same value of code or show the amount got in the code the user typed in order to check if the amount is the same of bill.

I was thought using a template and show the text box but I don’t now if I can use these formulas.  
Thx

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [May 17, 2021, 2:40pm UTC](https://community.glideapps.com/t/how-can-i-get-it-mid-formula-to-show-part-of-info-before-saving/26872/2 "2021-05-17T14:40:46Z")

</div>

Do you happen to know much about how the barcode is formulated? I know most barcodes have certain positions that mean different things, such as amount, account number, and other pieces of information…sometimes to control the machinery that folds the paper and stuffs envelopes…or mark the beginning and end of a batch of paperwork…or simply to to be scanned when payments are returned.

Do you happen to know what that number in the middle of the amount represents (the 5 in 1 **5** 2596 or the 1 in 1 **1** 6999). I would guess it’s some sort of check digit to verify the correct amount. Do you happen to know how that check digit is calculated?

---

<div class="post-metadata">

### Author: ![Alexandre\_Caruso](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/alexandre_caruso/32/6240_2.png) [@Alexandre\_Caruso](https://community.glideapps.com/u/Alexandre_Caruso)
#### Post date: [May 17, 2021, 3:00pm UTC](https://community.glideapps.com/t/how-can-i-get-it-mid-formula-to-show-part-of-info-before-saving/26872/3 "2021-05-17T15:00:12Z")

</div>

> [@Jeff\_Hager](#):
>
> Do you happen to know much about how the barcode is formulated? I know most barcodes have certain positions that mean different things, such as amount, account number, and other pieces of information…sometimes to control the machinery that folds the paper and stuffs envelopes…or mark the beginning and end of a batch of paperwork…or simply to to be scanned when payments are returned.
> 
> Do you happen to know what that number in the middle of the amount represents (the 5 in 1 **5** 2596 or the 1 in 1 **1** 6999). I would guess it’s some sort of check digit to verify the correct amount. Do you happen to know how that check digit is calculated?

Thx Jeff u r competly right. I know what´s each digit or block of them represents, but I dont know how to work with middle, left or right formula.

The formula that I sent is exactly how to get the amount of bill. so, I´d like to show to user, here it´s the amount of the code u´ve just written. That´s it. But again, I dont know how to work before saving.

Because I already do this in the GS, but I´d like to show, before save.  
Thx again.

Btw there is a national layout of banks here in Brazil because this format of bill is accepted in all of states of Brazil.

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [May 17, 2021, 3:27pm UTC](https://community.glideapps.com/t/how-can-i-get-it-mid-formula-to-show-part-of-info-before-saving/26872/4 "2021-05-17T15:27:22Z")

</div>

I guess what I’m trying to understand is the structure of the barcode and how it’s created.

Something like this???

> **[Layout\_Boleto\_BB\_V1.0.pdf](https://suporte.basesoft.com.br/Download/Updates/Layout_Boleto_BB_V1.0.pdf)**
>
> 503.72 KB

If I understand that, then I can understand how to generate that check digit in the middle of the amount and then insert it into the amount that the user entered. Once I have all of those pieces, then it would be easy to check if if the value (such as 00000011699) is included in the the barcode. The tricky part is that number that they insert into the middle of the amount.

The problem is that Glide does not currently offer any way to do string manipulation, such as MID, LEFT, etc. I’m working on a bit of a complicated math formula, but I’m not sure yet how reliable it will be. If I fully understood the structure of the barcode, then I think it would be better to build a value from what the user entered and then check that against the code.

Or if I could find out the type of barcode (since it sounds like it is a standard in Brazil), then I could do some searching in Google to find out more about it.

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [May 17, 2021, 3:43pm UTC](https://community.glideapps.com/t/how-can-i-get-it-mid-formula-to-show-part-of-info-before-saving/26872/5 "2021-05-17T15:43:38Z")

</div>

Here, try putting this in a Math Column and see how consistently it works.

```auto
(
TRUNC(
TRUNC(

((Code / 100000000000000000000000000000000 / 1000000000000)
-
TRUNC(Code / 100000000000000000000000000000000 / 1000000000000))

*
1000000000000

)

/ 100000)

+

MOD(
TRUNC(

((Code / 100000000000000000000000000000000 / 1000000000000)
-
TRUNC(Code / 100000000000000000000000000000000 / 1000000000000))

*
1000000000000

)

/ 10000
,1)
)

* 100

```

* * *
Here's a screenshot of it in my data.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/9/19985b17b3ab28ae3d16f741c8db1bbcb3b801b8.png)

---

<div class="post-metadata">

### Author: ![Alexandre\_Caruso](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/alexandre_caruso/32/6240_2.png) [@Alexandre\_Caruso](https://community.glideapps.com/u/Alexandre_Caruso)
#### Post date: [May 17, 2021, 5:08pm UTC](https://community.glideapps.com/t/how-can-i-get-it-mid-formula-to-show-part-of-info-before-saving/26872/6 "2021-05-17T17:08:46Z")

</div>

Oh my someone said u r genius! it’s truth! I’m gonna try later.

---

<div class="post-metadata">

### Author: ![Lucas\_Pires](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/lucas_pires/32/64863_2.png) [@Lucas\_Pires](https://community.glideapps.com/u/Lucas_Pires)
#### Post date: [May 17, 2021, 5:17pm UTC](https://community.glideapps.com/t/how-can-i-get-it-mid-formula-to-show-part-of-info-before-saving/26872/7 "2021-05-17T17:17:16Z")

</div>

Sure we do.

> [@Chuck Norris aka Jeff](https://community.glideapps.com/t/chuck-norris-aka-jeff/26818):
>
> Jeff has unlimited rows in his Glide Apps, because Jeff knows no bounds. Jeff sometimes has problems with if-then-else “is equal to”, because Jeff has no equal. Jeff’s apps don’t run slowly, because they know how to hurry the hell up. Jeff can solve the [Tower of Hanoi](https://en.wikipedia.org/wiki/Tower_of_Hanoi) puzzle with one column. Glide’s “My Teams” are not your teams, they’re Jeff’s. He just lets you use them. Customers never ask Jeff for estimations. Ever. Jeff’s beard can build an app in 7.3 minutes. “It works for me” is always tr…

---

<div class="post-metadata">

### Author: ![Lucas\_Pires](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/lucas_pires/32/64863_2.png) [@Lucas\_Pires](https://community.glideapps.com/u/Lucas_Pires)
#### Post date: [May 17, 2021, 5:18pm UTC](https://community.glideapps.com/t/how-can-i-get-it-mid-formula-to-show-part-of-info-before-saving/26872/8 "2021-05-17T17:18:21Z")

</div>

Holy moly Jeff! I try not to be surprised, but it gets hard … haha you can always do it! Stunning man

---

<div class="post-metadata">

### Author: ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)
#### Post date: [May 18, 2021, 12:40am UTC](https://community.glideapps.com/t/how-can-i-get-it-mid-formula-to-show-part-of-info-before-saving/26872/9 "2021-05-18T00:40:46Z")

</div>

I introduce you Mr Chuck “Jeff” Norris! 🕶
