Find

Question
· Sep 3, 2024

Count XML Elements EnsLib.EDI.XML.Document

Hello everyone,

I'm a bit confused about the number of elements in an XML object.
I have an object of the class EnsLib.EDI.XML.Document
The xsd structure ( DocType)  is an SDA Object

</container>
<Patient>
</Patient>
<Documents>
<Document>
    <DocumentNumber>0000000000000010008162012</DocumentNumber>
    <DocumentCompletionStatus><Code>IP</Code></DocumentCompletionStatus>
    <FileType>XML</FileType>
    <Stream>PD...</Stream>
</Document>
<Document>
    <DocumentNumber>0000000000000010008157893</DocumentNumber>
    <DocumentCompletionStatus><Code>IP</Code></DocumentCompletionStatus>
    <FileType>XML</FileType>
    <Stream>PD94bT....4=</Stream>
</Document>
</Documents>
</container>

 

How can I count the number of document? I have already tried to use the method choiceGetCount but get no result.

Generating an Xpath object and counting the elements did not work either.

Does anyone have an idea for me. I am sure that it is actually not difficult :-(

Kind regards

Armin

2 Comments
Discussion (2)1
Log in or sign up to continue
Question
· Sep 3, 2024

Autocommit pandas dataframe rows into IRIS

Hi,

I'm getting an unexpected behavior when using pandas function to_sql(), which uses sqlalchemy-iris. After the first execution, a transaction seems to be opened and all rows inserted are lost after closing the connection:

engine = create_engine(f"iris://{args['username']}:{args['password']}@{args['hostname']}:{args['port']}/{args['namespace']}")
conn = engine.connect()

# rows are kept after close connection
train_df.to_sql(name='table1', con=conn, if_exists='replace', index=False)

# rows **aren't** kept after close connection
train_df.to_sql(name='table2', con=conn, if_exists='replace', index=False)

conn.close()
engine.dispose()

I did some research and based on this stackoverflow post and this and this doc pages, I changed the connection and it worked:

conn = engine.connect().execution_options(isolation_level="AUTOCOMMIT")

Is this the best way to achive the desired behavior?

2 Comments
Discussion (2)1
Log in or sign up to continue
Question
· Sep 3, 2024

Wrong data conversion when returning ZTIMEH and ZTIME

I encountered an unexpected behavior while working with the $ZTIMEH and $ZTIME functions, specifically with times between 12:00 and 13:00. Here's what I observed:

 

W $ZTIMEH("08:50:38.975411826")
Output: 31838 

W $ZTIME(31838,1)
Output: 08:50:38
 

This behavior is correct as $ZTIME returns the expected time of 08:50:38.

However, with the following example:
 

W $ZTIMEH("12:05:38.975411826")
Output: 338

W $ZTIME(338,1)
Output: 00:05:38

 

This seems incorrect to me. $ZTIME should have returned 12:05:38, but instead it returns 00:05:38.

Based on our findings, this appears to only occur at times between 12pm and 1pm (12h/13h).

Has anyone else had this problem or found a workaround?

2 Comments
Discussion (2)1
Log in or sign up to continue
Question
· Sep 3, 2024

$ZDATETIME($h,3,1,3)

Hi,

I am using this "$ZDATETIME($h,3,1,3)" and getting response as 2024-09-03 12:07:45.000
But I need proper values at the end instead of zeros (000)

Something like below -
2024-09-03 12:07:45.658

6 Comments
Discussion (6)1
Log in or sign up to continue
Question
· Sep 3, 2024

如何结束 %SYSTEM.WorkMgr进程

我使用%SYSTEM.WorkMgr的多进程( multicompile=1)来处理数据,但是我发现执行完 WaitForComplete后,%SYSTEM.WorkMgr创建的进程没有马上结束,

他们的状态是evtw,如果我执行了很多次这样的操作,进程就会越来越多,它会导致服务器卡顿等异常,但是过一会儿他们会消失,留一个它不会消失。它产生的子进程其实是可以使用 $System.Process.Terminate(pid) 来结束,但是这样结束术后,它会有错误信息我的问题是如何正确的结束%SYSTEM.WorkMgr产生的子进程,如何避免服务器因此受到影响甚至宕机,为什么他会导致服务器出问题,有什么办法能再使用完成后,把 %SYSTEM.WorkMgr相关的进程正确的快速结束掉

Discussion (0)1
Log in or sign up to continue