Corentin Blondeau · Oct 4, 2023 go to post

I obtain this error : Erreur Cache: <LIST>zInsertList+5^%Collection.ListOfDT.1 when I call the InsertList method :

do context.listIdProcess.InsertList(callresponse.listId)

Thanks for your answer

Corentin Blondeau · Nov 5, 2024 go to post

Thank you
Do you think it can be a good idea to submit a proposition into InterSystems Ideas to have a specific bloc activity to call classMethod?

PPS : In order to test it, we can execute the following code in the terminal
 

Set sobj = ##class(%Net.UDP).%New(3001,"127.0.0.1")
zwrite sobj.Recv()

Update :
I have created a ticket to WRC. Indeed, there is a bug, the adapter is not working.
We have to use the ##class(%Net.UDP).%New()
Corentin

 Hello,
I have an other way to do it, it's a (little) bigger.
It doesn't need to indicate the package at the beginning.
The little addition is that this method can return all the classes that are differents without delete them.
 

/// Take as parameters /// ClassList whitch is the list return by ImportDir/// pDeleteIfExist : boolean to know if we have to delete classes/// listClassDiffer : lists of differents classes between the directory from ImportDir and InterSystems/// Return listClassDiffer; if error, return an exceptionClassMethod SynchroClass(ByRef classList As%String, pDeleteIfExist As%Boolean = 0, Output listClassDiffer As%ListOfDataTypes) As%Status
{
	Set status = $$$OK#dim exception As%Exception.AbstractExceptionSet tKey = ""Set listclass = ##class(%ListOfDataTypes).%New()
	Set listClassDiffer = ##class(%ListOfDataTypes).%New()

	Try{
		// insert the differentes classes from classList in a new list with a "while"Do{
			Set tKey=$ORDER(classList(tKey))
			//Write " tkey " ,tKey,!Do listclass.Insert(tKey)
		}While(tKey'="")

		Set SQLquery = "SELECT Name "Set SQLquery = SQLquery _ " FROM %Library.RoutineMgr_StudioOpenDialog('*.cls',1,1,0,1,0,0,,,0) "Set stmt = ##class(%SQL.Statement).%New()
		Set status = stmt.%Prepare(SQLquery)		
		Set rset = stmt.%Execute()
		#dim rset as%SQL.StatementResult/* get the table of result of the SQL request as classes of server and compare them to the classes from listclass
		if classes are different, we add them to the zreturn's parameter and we delete them */While rset.%Next(){
			Set name = rset.%Get("Name")
	
			//Write " name class and index ", name,idx, !If (listclass.Find(name) = ""){
				Write !,name
				Set status = listClassDiffer.Insert(name)
				$$$ThrowOnError(status)

				If (pDeleteIfExist){
					Set status = $SYSTEM.OBJ.Delete(name,"e")
					$$$ThrowOnError(status)
				}				
			}		
		}
	}Catch exception {
		Set status = exception.AsStatus()
	}
	Quit status
}

Thank you
You are right, there are some limitations and edge cases on my code.
To send huge stream, we need to split parts. But in order to do it properly, I think it need lot of works, since each part is re encode into string.
 

Thanks for your responses !!!
I found a way to do it with SQL :

Set sqlQuery = "SELECT * FROM %Dictionary.PropertyDefinition WHERE parent = '"_ className _"' ORDER BY SequenceNumber"Set resultSet = ##class(%SQL.Statement).%New()
    Set status = resultSet.%Prepare(sqlQuery)
    $$$ThrowOnError(status)
    Set tResult = resultSet.%Execute()
    
    While tResult.%Next() {
        Set Name = tResult.%Get("Name")
        ...
        }

Corentin