How to use lookup function ignoring first 4 chars and do the match
I am using below function and it works fine but i want to match the value ignoring the first 4 chars as they are only added to sort the data.
##class(Ens.Rule.FunctionSet).Lookup
For example
My table has following values
0001EMRNameB
0002EMRNameA
0003EMRNameC
w ^Ens.LookupTable("EMRName","0002EMRNameA") this works
But i want to use something like that
w ^(Ens.LookupTable("EMRName","%EMRNameA") this doesnt works
You can extract the values you want using $EXTRACT (or $E for short) where * represents the length of your string:
Set tValue = "0003EMRNameC"
Set tValueToLookup = $EXTRACT(tValue,5,*)
https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...
You should be able to put it on within the single function call if you prefer as well, but that's up to you.
Have you considered using SQL for this rather than going directly to the globals?
Sample code using Embedded SQL: