diff Resources/Samples/Lua/Autorouting.lua @ 1008:187ed107a59f lua-scripting

modify command
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Jul 2014 18:14:24 +0200
parents 871c49c9b11d
children 160dfe770618
line wrap: on
line diff
--- a/Resources/Samples/Lua/Autorouting.lua	Tue Jul 08 17:35:00 2014 +0200
+++ b/Resources/Samples/Lua/Autorouting.lua	Tue Jul 08 18:14:24 2014 +0200
@@ -69,12 +69,14 @@
    --PrintRecursive(metadata)
    --print(metadata['RemoteAET'])
 
-   if true then
+   if (metadata['ModifiedFrom'] == nil and
+       metadata['AnonymizedFrom'] == nil) then
       local patientName = string.lower(tags['PatientName'])
       if string.find(patientName, 'david') ~= nil then
          --Delete(SendToModality(instanceId, 'sample'))
          --Delete(SendToPeer(instanceId, 'peer'))
-         Delete(SendToModality(Modify(instanceId, { PatientName = 'Hello^World' }), 'sample'))
+         SendToModality(Modify(instanceId, { PatientName = 'Hello^World' }), 'sample')
+         Delete(instanceId)
       else
          Delete(instanceId)
       end