Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
Correct syntax for a nested loop

I want to run this loop for every row that has a startTime within the last 6 months (183 days). The Scripted service is retuning some of fields from a database and some from an api. Do I require a nested loop? I tried the second code block but nothing was returned.

SELECT
    Results.userIdentifier,
    Results.userIdentifier,
    Results.startTime,
    Results.userEmail,
    Results.fullName
FROM {{
        var SCRIPTED_SERVICE_NAME = "Scripted Service"; 
        var results = [];        
        
        var returnValue = extFuncService.get(SCRIPTED_SERVICE_NAME);
        for each (var row in returnValue)
                results.push({
                    userIdentifier: row.userIdentifier,
                    userNamespace: row.userNamespace,
                    startTime: row.startTime,
                    userEmail: row.userEmail,
                    fullName: row.fullName,
                });    
        }

        results;
    }} as Results
SELECT
    Results.userIdentifier,
    Results.userIdentifier,
    Results.startTime,
    Results.userEmail,
    Results.fullName
FROM {{
        var SCRIPTED_SERVICE_NAME = "Scripted Service"; 
        var results = [];        
        
        var returnValue = extFuncService.get(SCRIPTED_SERVICE_NAME);
        for each (var row in returnValue)
            while (row.startTime >= (SELECT GETDATE()-183))
                results.push({
                    userIdentifier: row.userIdentifier,
                    userNamespace: row.userNamespace,
                    startTime: row.startTime,
                    userEmail: row.userEmail,
                    fullName: row.fullName,
                });  
            }      
        }

        results;
    }} as Results
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!