我正在使用界面件鬣蜥和变色龙生成HL7消息。这是我第一次接触Python,所以这个问题可能还不成熟。我正在尝试使用分段迭代器对象循环访问消息。
current_segment = environment.input_segment_iterator()
current_segment.apply_transform()
output = current_segment.output()
if current_segment.move_next('OBX'):
log('OBX setId is ' + current_segment.field(1).value );
我已经在全局后处理方程窗口中编写了此脚本,但它总是给我一个错误说
RuntimeError: Invalid iterator must be reset before being used while calling apply_transform
while executing the outgoing post process equation for the project.
我看过很多使用迭代器的例子,都遵循相同的模式。如何重置此迭代器,为什么无效?
在做了一些研究工作后,我发现我不能在post process
方程窗口中使用input_segment_iterator
,而是在transformation
窗口中使用。现在,我能够看到我使用变色龙的Test Mapping
功能对脚本所做的更改。但是,如何将此更改配置为在使用此vmd
生成的每条消息上实施?
我认为使用INTERFACEWARE变色龙和鬣蜥产品的人可以轻松帮助我。
不是鬣蜥人,但我相信你错过了这个
current_segment.reset()
遍历完 OBX 后,以便将当前段设置为 MSH。
可以在此页上查看示例用法。