I am trying to write this loop as efficient as possible. The global has over 10 million records.
SET PIDX=""
For
{
Set PIDX=$ORDER(^[Nspace]LAB(PIDX))
Quit:PIDX=""
Set Data=$GET(^[Nspace]LAB(PIDX))
Set BBData=$P(Data,"\",6)
If BBData'=""
{
If BBData'="########"
{
Am I better off not setting the variable BBData and using If $P(Data,"\",6)'=""
Also, is there a better way to write the two If statements in one line so it only continues if it is either "" or ########