Hello Enrico Parisi, @Enrico Parisi, thanks for your questions and thanks for your reply, sincerely.

The required logic is to merge the "resource" objects within the "entry" arrays, focusing solely on the "resource" objects. The process should not merge the entire entries themselves but rather extract and combine the "resource" objects from each entry.

Here's a brief summary of the logic:

    - Extract the "resource" objects from each "entry" in response1 and response2.
    - Combine these "resource" objects into a single array.
    - Ensure the merged JSON contains only the combined "resource" objects, maintaining the integrity and structure of each "resource".
    
Please let me know if further clarification is needed.

Thanks Enrico Parisi for your time, reply and help.

Thanks for your reply, Julius.

I understand your concern and would like to clarify the point of single digit numbers in this context.

The definition we have given is: “A number is Aesthetic if, in any base from base 2 to base 10, the absolute difference between each pair of adjacent digits is consistently equal to 1.” Now, when we talk about single digit numbers, they technically have no adjacent digits to compare, which may seem confusing.

However, in this context, we consider a single-digit number to be trivially aesthetic because there are no pairs of digits that can contradict the condition that the absolute difference is 1. In other words, there is no comparison to make that could invalidate the aesthetics of the number.

It is as if we were to say that a straight line is “smooth” because it has no curves that could make it rough. Similarly, a single digit is aesthetic because there are no differences between digits that would break the aesthetics.

In the case of the number 1, no matter what base you represent it in, it will always be a single digit. Therefore, there is no pair of adjacent digits to compare, and for this reason, it is considered to trivially meet the condition of being aesthetic.

I hope this clears up the doubt and justifies why a single digit number is considered aesthetic in any basis.

🙂🤔💭🟢 Thank you Julius for your deep reply and interesting observations, honestly they are totally right.

Greetings.

Hello everyone,

I appreciate your responses and perspectives on the challenge I posted. It's important to clarify that my intention was simply to share a programming challenge out of curiosity, and the context or the scenario of the programming challenge was created by another user. It's not a reflection of personal beliefs or values, but rather an abstract context in which this programming challenge was formulated.

Robert, I completely understand your viewpoint, and I respect your perspective based on your experiences. Marriage is indeed a deeply personal matter, and financial considerations may vary greatly from person to person.

Ba, thank you for sharing your experience. It's wonderful that your parents were able to support you during your wedding, and it's a testament to the importance of family support during such significant life events.

Luc, your perspective adds an interesting angle to the discussion. Indeed, the decision to allocate resources, whether for a wedding or other purposes, is deeply intertwined with individual priorities and values.

Once again, thank you all for engaging in the conversation, and I hope we can continue to share insights and perspectives in a respectful manner.

To be sincere and to be honest I did only posted it because I was curious about how could you solve it using ObjectScript. ✅✅✅🟩🟩🟩✅✅✅

Sorry if the context is not the best one.

We have tried to solve this issue ourselves as follows:

We have changed the method's output parameter, from an Ens.Response to an %XML.String(MAXLEN=""):

Before:

Method ProcesarPeticion(MSH As hl7.MSH.CONTENT, NTE As hl7.NTE.CONTENT, ORMO01PATIENT As hl7.ORMO01.PATIENT.CONTENT(XMLNAME="ORM_O01.PATIENT"), ORMO01ORDER As hl7.ORMO01.ORDER.CONTENT(XMLNAME="ORM_O01.ORDER"), SFT As hl7.SFT.CONTENT, MSA As hl7.MSA.CONTENT, ERR As hl7.ERR.CONTENT) As Mensajes.Response.Peticiones.Derivaciones.EnvioPeticiones.operacionResponse [ Final, ProcedureBlock = 1, SoapAction = "http://FUERTEVENTURA.Servicios/Asentimientos/ProcesarACK", SoapBindingStyle = document, SoapBodyUse = literal, SoapMessageName = ACK, SoapRequestMessage = ORM_O01, WebMethod ]

After:

Method ProcesarPeticion(MSH As hl7.MSH.CONTENT, NTE As hl7.NTE.CONTENT, ORMO01PATIENT As hl7.ORMO01.PATIENT.CONTENT(XMLNAME="ORM_O01.PATIENT"), ORMO01ORDER As hl7.ORMO01.ORDER.CONTENT(XMLNAME="ORM_O01.ORDER"), SFT As hl7.SFT.CONTENT, MSA As hl7.MSA.CONTENT, ERR As hl7.ERR.CONTENT) As %XML.String(MAXLEN="") [ Final, ProcedureBlock = 1, SoapAction = "http://FUERTEVENTURA.Servicios/Asentimientos/ProcesarACK", SoapBindingStyle = document, SoapBodyUse = literal, SoapMessageName = ACK, SoapRequestMessage = ORM_O01, WebMethod ]

In addition we have converted the Ens.Response Message to XML with the following code:

;30/01/2024 convertir a XML para quitar las etiquetas SOAP sobrantes:
set writer=##class(%XML.Writer).%New()
set status=writer.OutputToString()
If $$$ISERR(status) Do $system.OBJ.DisplayError(status)
set status=writer.RootObject(response)
If $$$ISERR(status) Do $system.OBJ.DisplayError(status) set pResponse = writer.GetXMLString()
$$$LOGALERT("pResponse: "_pResponse) ;set inicioCabeceras = "<?xml version=""1.0"" encoding=""UTF-8""?><ACK xmlns=""urn:hl7-org:v2xml"">"
;$$$LOGINFO("inicioCabeceras: "_inicioCabeceras)
set sinInicio = $PIECE(pResponse,"<operacionResponse>",2)
$$$LOGINFO("sinInicio: "_sinInicio)
set sinInicioFinal = $PIECE(sinInicio,"</operacionResponse>",1)
$$$LOGINFO("sinInicioFinal: "_sinInicioFinal)
set finalCabeceras = "</ACK>"
$$$LOGINFO("finalCabeceras: "_finalCabeceras)
;set mensajeACKcompleto = inicioCabeceras_sinInicioFinal_finalCabeceras
set mensajeACKcompleto = sinInicioFinal
$$$LOGINFO("mensajeACKcompleto: "_mensajeACKcompleto) ;quit response
quit mensajeACKcompleto
 

Being the Service's full code as we show:

Class Servicios.Peticiones.Derivaciones.Gestionv01r00 Extends EnsLib.SOAP.Service [ ClassType = "", Inheritance = right, ProcedureBlock ]
{

Parameter ADAPTER = "EnsLib.SOAP.InboundAdapter";

/// Nombre del WebService.
Parameter SERVICENAME = "Gestion";

/// Namespace SOAP para el Servicio Web
Parameter NAMESPACE = "urn:hl7-org:v2xml";

/// Se utilizarán namespaces de clases referenciadas en WSDL.
Parameter USECLASSNAMESPACES = 1;

Method ProcesarPeticion(MSH As hl7.MSH.CONTENT, NTE As hl7.NTE.CONTENT, ORMO01PATIENT As hl7.ORMO01.PATIENT.CONTENT(XMLNAME="ORM_O01.PATIENT"), ORMO01ORDER As hl7.ORMO01.ORDER.CONTENT(XMLNAME="ORM_O01.ORDER"), SFT As hl7.SFT.CONTENT, MSA As hl7.MSA.CONTENT, ERR As hl7.ERR.CONTENT) As %XML.String(MAXLEN="") [ Final, ProcedureBlock = 1, SoapAction = "http://FUERTEVENTURA.Servicios/Asentimientos/ProcesarACK", SoapBindingStyle = document, SoapBodyUse = literal, SoapMessageName = ACK, SoapRequestMessage = ORM_O01, WebMethod ]
{
	set request = ##class(Mensajes.Request.Peticiones.Derivaciones.EnvioPeticiones.operacionRequest).%New()
	set request.MSH = MSH
	do request.NTE.Insert(NTE)
	set request.ORMO01PATIENT = ORMO01PATIENT
	do request.ORMO01ORDER.Insert(ORMO01ORDER)
	
	set tSC = ..SendRequestSync("EnrutadorGestionDerivaciones",request,.response)
	
	;30/01/2024 convertir a XML para quitar las etiquetas SOAP sobrantes:
	set writer=##class(%XML.Writer).%New()
	set status=writer.OutputToString()
	If $$$ISERR(status)

	Do $system.OBJ.DisplayError(status)
	set status=writer.RootObject(response)
	If $$$ISERR(status) Do $system.OBJ.DisplayError(status)

	set pResponse = writer.GetXMLString()
	$$$LOGALERT("pResponse: "_pResponse)
	
	;set inicioCabeceras = "<?xml version=""1.0"" encoding=""UTF-8""?><ACK xmlns=""urn:hl7-org:v2xml"">"
	;$$$LOGINFO("inicioCabeceras: "_inicioCabeceras)
	set sinInicio = $PIECE(pResponse,"<operacionResponse>",2)
	$$$LOGINFO("sinInicio: "_sinInicio)
	set sinInicioFinal = $PIECE(sinInicio,"</operacionResponse>",1)
	$$$LOGINFO("sinInicioFinal: "_sinInicioFinal)
	set finalCabeceras = "</ACK>"
	$$$LOGINFO("finalCabeceras: "_finalCabeceras)
	;set mensajeACKcompleto = inicioCabeceras_sinInicioFinal_finalCabeceras
	set mensajeACKcompleto = sinInicioFinal
	$$$LOGINFO("mensajeACKcompleto: "_mensajeACKcompleto)
	
	;quit response
	quit mensajeACKcompleto
}

Method OnProcessInput(pInput As EnsLib.HL7.Message) As %Status
{
   Quit ..SendRequestAsync("EnrutadorGestionDerivaciones",pInput)
}

}

When we execute it, the $$$LOGINFO("mensajeACKcompleto: "_mensajeACKcompleto) does outputs the desired output:

<MSH xmlns:s01="urn:hl7-org:v2xml">
	<s01:MSH.1>|</s01:MSH.1>
	<s01:MSH.2>
		<![CDATA[^~\&]]>
	</s01:MSH.2>
	<s01:MSH.3>
		<s01:HD.1>sistemaExterno</s01:HD.1>
	</s01:MSH.3>
	<s01:MSH.4>
		<s01:HD.1>scs</s01:HD.1>
		<s01:HD.2>350290</s01:HD.2>
	</s01:MSH.4>
	<s01:MSH.5>
		<s01:HD.1>HGF</s01:HD.1>
	</s01:MSH.5>
	<s01:MSH.6>
		<s01:HD.1>EXTHL7</s01:HD.1>
	</s01:MSH.6>
	<s01:MSH.7>
		<s01:TS.1>20240130110908</s01:TS.1>
	</s01:MSH.7>
	<s01:MSH.9>
		<s01:MSG.1>ACK</s01:MSG.1>
	</s01:MSH.9>
	<s01:MSH.10>70589905</s01:MSH.10>
	<s01:MSH.11>
		<s01:PT.1>P</s01:PT.1>
	</s01:MSH.11>
	<s01:MSH.12>
		<s01:VID.1>2.5</s01:VID.1>
	</s01:MSH.12>
	<s01:MSH.13>1</s01:MSH.13>
	<s01:MSH.15>AL</s01:MSH.15>
	<s01:MSH.16>AL</s01:MSH.16>
	<s01:MSH.18>ASCII</s01:MSH.18>
</MSH>
<MSA xmlns:s01="urn:hl7-org:v2xml">
	<s01:MSA.1>AA</s01:MSA.1>
</MSA>

However, when we see the response being replied by the SOAP Service to the SoapUI it shows the extra XML tag "<ProcesarPeticionResult>":

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2001/XMLSchema">
	<SOAP-ENV:Body>
		<ACK xmlns="urn:hl7-org:v2xml">
			<ProcesarPeticionResult>
				<MSH xmlns:s01="urn:hl7-org:v2xml">
					<s01:MSH.1>|</s01:MSH.1>
					<s01:MSH.2>^~\&amp;</s01:MSH.2>
					<s01:MSH.3>
						<s01:HD.1>sistemaExterno</s01:HD.1>
					</s01:MSH.3>
					<s01:MSH.4>
						<s01:HD.1>scs</s01:HD.1>
						<s01:HD.2>350290</s01:HD.2>
					</s01:MSH.4>
					<s01:MSH.5>
						<s01:HD.1>HGF</s01:HD.1>
					</s01:MSH.5>
					<s01:MSH.6>
						<s01:HD.1>EXTHL7</s01:HD.1>
					</s01:MSH.6>
					<s01:MSH.7>
						<s01:TS.1>20240130110908</s01:TS.1>
					</s01:MSH.7>
					<s01:MSH.9>
						<s01:MSG.1>ACK</s01:MSG.1>
					</s01:MSH.9>
					<s01:MSH.10>70589905</s01:MSH.10>
					<s01:MSH.11>
						<s01:PT.1>P</s01:PT.1>
					</s01:MSH.11>
					<s01:MSH.12>
						<s01:VID.1>2.5</s01:VID.1>
					</s01:MSH.12>
					<s01:MSH.13>1</s01:MSH.13>
					<s01:MSH.15>AL</s01:MSH.15>
					<s01:MSH.16>AL</s01:MSH.16>
					<s01:MSH.18>ASCII</s01:MSH.18>
				</MSH>
				<MSA xmlns:s01="urn:hl7-org:v2xml">
					<s01:MSA.1>AA</s01:MSA.1>
				</MSA>
			</ProcesarPeticionResult>
		</ACK>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

How could we achieve to remove the undesired "<ProcesarPeticionResult>" XML tag?

Thanks for your time.

Thanks for your help.

Thanks for your replies.

Could you please, help us? By pointing some documentation or linking to some example to address this need?

Thanks for your answers.