Kurro Lopez · Sep 3, 2020 go to post

Indeed.

The parameter 3 in $ZDATE and $ZDATEH is the format of the date YYYY-MM-DD ODBC format

$HOROLOG retrieves the system datetime, so $ZDATE($HOROLOG,3) gives the current sytem date

Usually, HL7.{PID.7} uses the format YYYY-MM-DD, so it converts the string into a datetime variable ($ZDATEH(dob,3))

Please, find out the info in $ZDATE and $ZDATEH documentation.

Best regards,
Francisco Lopez

P.S. Don't forget mark the answer as accepted wink

Kurro Lopez · Sep 3, 2020 go to post

I've found the solution.

ClassMethod CreateTask() As %Status
{
    Set task=##class(%SYS.Task).%New()
    Set task.Name = "Check laboratory process"
    Set task.NameSpace=$Namespace
    Set task.TimePeriod=0 // Daily
    Set task.TimePeriodEvery=1 // Every 1 day
    Set task.DailyFrequency=0 // Run once
    Set taskdef = ##class(MyTasks.LabsTask).%New()
    Do task.AssignSettings(taskdef)
    Set task.TaskClass=$classname(taskdef)
    Set task.Settings=$lb("Laboratory","LABS1")
    
    Set st = task.%Save()
    Return:$$$ISERR(st) st
    Return ##class(%SYS.Task).RunNow(task.%Id())
}
Kurro Lopez · Sep 3, 2020 go to post

One question,

If my %SYS.Task.Definition class needs a parameter, how to add it in the %SYS.Task definition?

this is my task

Class MyTasks.LabsTask Extends %SYS.Task.Definition
{

Parameter PROPERTYVALIDATION = 1;

Parameter BPDOPROCESS= "MyLabs.BS.Process";

Parameter TaskName = "Check process of labs";

Property Laboratory As %String [ Required ];

Method OnTask() As %Status
{
    #Dim tService As Service.class
    set tSC = $$$OK
    set message = ##class(Ens.StringContainer).%New(..Laboratory)
    $$$ThrowOnError(##class(Ens.Director).CreateBusinessService(..#BPDOPROCESS, .tService))
    If ($IsObject(tService)) {
        Set tSC = tService.ProcessInput(message,.output)
    }
    
    Quit tSC
}

}

Regards,
Francisco Lopez

Kurro Lopez · Sep 2, 2020 go to post

You can use DATEDIFF function to check the days between both date

set date1 = $zdate($horolog,3)
set date2 = $zdate($zdateh("2020-09-01",3),3)
write $SYSTEM.SQL.DATEDIFF("dd",date2,date1)     // 1

In your scenario it could be like this:

$SYSTEM.SQL.DATEDIFF("dd",$ZDATE($ZDATEH(HL7.{PID.7},3),3),$ZDATE($HOROLOG,3)) <= 3

This is a boolean condition, so your rule only have that condition

UPDATE

Rules only accept functions from functions class, so you should create a new class with that function:

Class MyFunctions Extends Ens.Rule.FunctionSet
{
ClassMethod DaysDobHL7(pDob As %String) As %Integer
{
    set date1 = $zdate($horolog,3)
    set date2 = $zdate($zdateh(pDob,3),3)
    
    quit $SYSTEM.SQL.DATEDIFF("dd",date2,date1)
}

then, your new function should be visible in rules function

Regards,
Francisco Lopez

Kurro Lopez · Aug 26, 2020 go to post

Finally, I've added the following method in request class

 
Method Find(item As LabCenter)
{
    for i=1:1:..ListCenter.Count(){
        set tmp=..ListCenter.GetAt(i)
        if tmp.LabId=item.LabIdtmp.Center=item.Centertmp.Code=item.Code return i
    }

 

    quit 0
}

By this way, I find my Lab-Center

> set obj=##class(ListLabCenter).%OpenId(1)
> zw obj
obj=<OBJECT REFERENCE>[2@ListLabCenter]
+----------------- general information ---------------
|      oref value: 2
|      class name: ListLabCenter
|           %%OID: $lb("1","ListLabCenter")
| reference count: 2
+----------------- attribute values ------------------
|       %Concurrency = 1  <Set>
+----------------- swizzled references ---------------
|      i%ListCenter = ""
|   i%ListCenter(1) = $lb($lb("A08829848","A088298480001",""))
|   i%ListCenter(2) = $lb($lb("A08829848","A088298480002",""))
|   i%ListCenter(3) = $lb($lb("A08829848","A088298480003",""))
|   i%ListCenter(4) = $lb($lb("U66700196","U667001960002",""))
|   i%ListCenter(5) = $lb($lb("U66700196","U667001960003",""))
|   r%ListCenter = "1@%Collection.ListOfObj"
|   r%ListCenter(1) = "3@LabCenter"
+-----------------------------------------------------
> set objFind = ##class(LabCenter).%New()
> set objFind.LabId="A08829848"
> set objFind.Center="A088298480003"
> zw objFind
objFind=<OBJECT REFERENCE>[5@LabCenter]
+----------------- general information ---------------
|      oref value: 5
|      class name: LabCenter
| reference count: 2
+----------------- attribute values ------------------
|             Center = "A088298480003"
|               Code = ""
|              LabId = "A08829848"
+-----------------------------------------------------
> w obj.Find(objFind)
3
> set objFindFake = ##class(LabCenter).%New()
> set objFindFake.LabId="FAKE"
> set objFindFake.Center="A088298480003"
> w obj.Find(objFindFake)
0

Thanks for your help.

Best regards,
Francisco López

Kurro Lopez · Aug 26, 2020 go to post

Thanks for your code.

I'm afraid that I'll use a loop to search my lab-center instead of find using a ENSLib function.

I've updated my question to clarify what is the real scenario.

Best regards,
Francisco López

Kurro Lopez · Jul 13, 2020 go to post
In deed,

The problem is in the backspace ($ c (8, ......)) because that character is not recognized in an HTML simulation.

Please, try to change this line:

 f  v#1 q:(v?.1n) " !no number", $c(27,91)_12_"D"

This is the ESC [12D statement which is the same than $c(8) but the WebTerminal is able to interpret it

I hope it helps you

Best regards,

Kurro López

Kurro Lopez · May 28, 2020 go to post

We are preparing a great concert to celebrate it with world famous guests, such as Beyonce, Jenifer Lopez, Maluma, Elton John, Paul McCartney, Rosalia, and some other surprises ...
We are waiting for the pandemic to allow us to do so, or we are going to have to suspend it.

hehehe, just kidding ... we will have a couple of beers for what we have done and for what we are going to do.

Thanks @Anastasia Dyubaylo 
 

Kurro Lopez · May 21, 2020 go to post

To be honest... I'm using all at the same time:

Develop: VSCode
Debug: Studio
Synchronize code from server: Atellier

I have some problems to synchronize code from server to local code in VSCode, so I trust in Atellier.

Kurro Lopez · Apr 17, 2020 go to post

I've checked the locktable and it displays a lot of them :s

is possible to unlock all of them at the same time? I have to do one on one...

Kurro Lopez · Feb 20, 2020 go to post

That depends on your data model.

If you require many related tables, it may be more useful to have the invocation with the data you need by appending the tables by primary keys.


SELECT table1.code, table2.description
FROM table1
INNER JOIN table2 ON table2.tab_id = table1.id

Also, it's important create the proper index to the fields that you need to search.

There is not a simple answer :)

Best Regards,
Francisco Lopez

Kurro Lopez · Jan 30, 2020 go to post

Great, I have some questions about VSCode-ObjectScript. It is the best occasion to ask the creator of the application directly.

Kurro Lopez · Oct 31, 2019 go to post

It's just I need... By this way, I have the version number

Many thanks

Kurro Lopez · Oct 31, 2019 go to post

Good approach, thanks for your answer.

The methods will be exactly the same as before. The changes in version is a slight change in BP, so I need which version is calling. If I user the version number as parameter, I can add into a message and calls to BP with the version and not replay all methods for each version.

I'll be in mind for future versions.

Thanks

Kurro Lopez · Oct 19, 2019 go to post

I think it is a "Best practice", but the information is scattered throughout the conversation.

Why not create a last comment with a brief of the conversation, with pros and cons?

It could be more clear.

Regards
 

Kurro Lopez · Oct 18, 2019 go to post

None of them. The best practices is "Do what you want"... hehe

Now seriously. I think the best practices is use according to the explication of each comment. Use brace to delimit the scope, not use if you have one line and precondition, etc..

Kurro Lopez · Sep 5, 2019 go to post

Last time, we have a value of 10 and the error increases more frequently, even when I was loading files.

So, the idea is to put a value like 30 seconds to allow that time the TCP disconnection. If I change the value to 30 (or 60), can the process open the TCP connection automatically and try to connect to FTP? If I leave it indefinitely (-1), is there a way to make the connection again?

Kurro Lopez · Sep 4, 2019 go to post

This is the configuracion in DEV environment, in Prerelease it has that value in SSL configuration.