I working with payroll. I have codes like L1-Hrl but also some with just one letter like G-Hrl. I need to extract just what is before the dash resulting of L1 and G.
I working with payroll. I have codes like L1-Hrl but also some with just one letter like G-Hrl. I need to extract just what is before the dash resulting of L1 and G.
You can use the Left() function along with the InStr() function to find the position of the dash.
Got it:
Lettercode: Left([payrollitem],(Instr(1,[payrollitem],"-")-1))
This give me the correct answer.
Just for info, you can also do this using the Split function e.g. Split("l1-grl", "-")(0)
Unfortunately this can't be used directly in a query but a workaround is to use the String_Split function which can be used in queries
See https://www.devhut.net/2018/04/22/ac...it-in-a-query/
Using this approach your query field becomes
You might find this approach easier in futureCode:String_Split([payrollitem],0,"-")