go to post Colin Gadumer · Jun 5 By the Power of ChatGPT it is: Triple Quotes. Spoiler # Test string escaping for IRIS session routine calls param( [string]$Instance = "healthconnect", [string]$TestString = "Your String Here" ) Write-Host "Testing string escaping for IRIS session routine calls" -ForegroundColor Cyan Write-Host "Instance: $Instance" -ForegroundColor Yellow Write-Host "Test String: '$TestString'" -ForegroundColor Yellow Write-Host "" # Array of different escape patterns to test $escapeTests = @( @{ Name = "Backtick quotes" Pattern = 'Say^ImplUtil(`"' + $TestString + '`")' }, @{ Name = "Single quotes around whole command" Pattern = "Say^ImplUtil(""$TestString"")" }, @{ Name = "Double quotes escaped with backslash" Pattern = 'Say^ImplUtil(\"' + $TestString + '\")' }, @{ Name = "Single quotes inside double quotes" Pattern = "Say^ImplUtil('$TestString')" }, @{ Name = "No quotes around string" Pattern = "Say^ImplUtil($TestString)" }, @{ Name = "Backtick escaped double quotes" Pattern = "Say^ImplUtil(`"$TestString`")" }, @{ Name = "Double backtick quotes" Pattern = 'Say^ImplUtil(``"' + $TestString + '``")' }, @{ Name = "Triple quotes" Pattern = 'Say^ImplUtil("""' + $TestString + '""")' }, @{ Name = "Percent encoding style" Pattern = "Say^ImplUtil(%22$TestString%22)" }, @{ Name = "Curly braces" Pattern = "Say^ImplUtil({$TestString})" } ) $successfulPatterns = @() foreach ($test in $escapeTests) { Write-Host "Testing: $($test.Name)" -ForegroundColor White Write-Host "Pattern: $($test.Pattern)" -ForegroundColor Gray try { # Test the pattern $result = irissession $Instance -U user $test.Pattern 2>&1 # Check if it's an invalid argument error if ($result -match "INVALID ARGUMENT" -or $result -match "ERROR" -or $result -match "SYNTAX ERROR") { Write-Host "❌ FAILED: $result" -ForegroundColor Red } else { Write-Host "✅ SUCCESS: $result" -ForegroundColor Green $successfulPatterns += $test } } catch { Write-Host "❌ EXCEPTION: $_" -ForegroundColor Red } Write-Host "" } # Summary Write-Host "=== SUMMARY ===" -ForegroundColor Cyan if ($successfulPatterns.Count -gt 0) { Write-Host "Successful patterns:" -ForegroundColor Green foreach ($pattern in $successfulPatterns) { Write-Host " ✅ $($pattern.Name): $($pattern.Pattern)" -ForegroundColor Green } } else { Write-Host "No successful patterns found. Consider testing with a simpler command first." -ForegroundColor Yellow } Testing: Triple quotesPattern: Say^ImplUtil("""Your String Here""")✅ SUCCESS: Your String Here I'm fairly certain i tested this before though. 🤔
go to post Colin Gadumer · Jun 5 thank you for confirming my approach, but unfortunately that's not how it works it seems. PS C:\Users\Colin\Desktop> irissession healthconnect -U user 'Say^ImplUtil("Your String Here")' <INVALID ARGUMENT>>
go to post Colin Gadumer · Sep 30, 2021 Is this a single instance? if so you could map the lookup table to all namespaces as a subscript of ^Ens.LookupTable