cancel
Showing results for
Did you mean:
Highlighted
Post Prodigy

Truncate Text

I have built an app that pulls available vacation hours for employees. However, in SQL table for 80 hours it is listed as 8000 and 120 hours is listed as 12000. I am trying to use LEFT truncate function to drop off the last 2 zeros but that doesn't work for both 8000 and 12000. If I do LEFT 2, I get 80 for the 8000 (which is correct) but only 12 for the 12000. Is there a way to truncate both numbers correctly int he same label? Thank you.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User

Re: Truncate Text

Try to combine the LEN and LEFT functions. Use LEN to first get the length of the string and then that length - 2 can be the parameter to the LEFT function.

Something like this:
Left(DeptTxt_2.Text, LEN(DeptTxt_2.Text)-2)

Let me know if this works. I am in front of my computer right now but believe this should work.

---

Thanks!
Hardit Bhatia
Super User

Re: Truncate Text

Try
Left(DeptTxt_2.Text, Len(DeptTxt_2.Text)-2)

Let me know if this helps.

---

Thanks!
Hardit Bhatia
4 REPLIES 4
Super User

Re: Truncate Text

I think the way to go here is:

vacation_available/100

Your database is probably storing the values as integers with the 2 right-most digits for decimal places.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Super User

Re: Truncate Text

Try to combine the LEN and LEFT functions. Use LEN to first get the length of the string and then that length - 2 can be the parameter to the LEFT function.

Something like this:
Left(DeptTxt_2.Text, LEN(DeptTxt_2.Text)-2)

Let me know if this works. I am in front of my computer right now but believe this should work.

---

Thanks!
Hardit Bhatia
Post Prodigy

Re: Truncate Text

I tried but got an error: Invocation of Unknown or Unsupported Function

Super User

Re: Truncate Text

Try
Left(DeptTxt_2.Text, Len(DeptTxt_2.Text)-2)

Let me know if this helps.

---

Thanks!
Hardit Bhatia

Announcements