Answers:
The portlet that you showed a screen shot of (with the differing number formats) - what is that? Is it NSQL based?
What does the NSQL look like?
It's a View is not a portlet, i was confused when i wrote. Is a XML that have a SQL query inside. I show you below
What does the database columns that the data is being derived from look like (the column datatype)?
What does the data in those columns look like (for the differing formats)? (selected in a SQL tool).
I tried with differents formats and doesn't worked. BUT if i replace the values with numbers with comma, works fine.
Here is the XML, this is the same that ran always until the 27/05, from there doesn't worked any more.
<gel:script xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:core="jelly:core"
xmlns:file="jelly:com.niku.union.gel.FileTagLibrary"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="jelly:sql" xmlns:xog="http://www.niku.com/xog"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- PARAMETROS DE CUENTA -->
<!-- ==================== -->
<gel:parameter default="" var="p_XOGUsername"/>
<gel:parameter default="" secure="true" var="p_XOGPassword"/>
<gel:parameter default="" var="p_verbose"/>
<gel:parameter default="http://localhost" var="p_host"/>
<!-- DATASOURCE -->
<!-- ========== -->
<gel:setDataSource dbId="niku"/>
<gel:out>[Actualización de EV] Inicio de Proceso</gel:out>
<gel:log category="XOG" level="INFO">Inicio de Proceso</gel:log>
<!-- SE EJECUTA LA QUERY -->
<!-- =================== -->
<sql:query escapeText="0" var="v_query_1"><![CDATA[
------------------------------------------------------------------------------------------
-- Proceso de:
-- ITAU - Actualiza EV Histórico
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
-- Proceso de:
-- ITAU - Actualiza EV Histórico
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
-- Proceso de:
-- ITAU - Actualiza EV Histórico
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
-- Proceso de:
-- ITAU - Actualiza EV Histórico
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
-- Proceso de:
-- ITAU - Actualiza EV Histórico
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
-- Proceso de:
-- ITAU - Actualiza EV Histórico
------------------------------------------------------------------------------------------
DECLARE @FechaCorte datetime
SET @FechaCorte = DATEDIFF(d,1,getDate())
SELECT
--Programa
CASE WHEN PROG.id is null THEN inv.id ELSE PROG.id END IdPrograma,
CASE WHEN PROG.name is null THEN inv.name ELSE PROG.name END NombrePrograma,
inv.name NombreProyecto, inv.id IdProyecto,
tsk.prid IdTarea, tsk.prname NombreTarea, prwbssequence WBSSeq,
TSK.prpctcomplete PorcFinalizado,
isnull(DET.USAGE_SUM/3600,0) EstimadoBLEnCurso,
--Si las horas incurridas es igual a 0 para una tarea finalizada
--Entonces tomar el estimado.
--Esto es para no premiar tanto la mala carga de horas de una tarea en otra
CASE WHEN isnull(HORAS.incurridas,0) = 0 AND TSK.prpctcomplete=1
THEN isnull(DET.USAGE_SUM/3600,0)
ELSE isnull(HORAS.incurridas,0)
END HorasIncurridas,
convert(DECIMAL(6,4),(isnull(DET.USAGE_SUM/3600,0)*TSK.prpctcomplete)/100) EV_Calculado,
--Sacamos el valor planificado que debería tener la tarea
--Si la tarea no debería haber comenzado para la fecha en la que estamos sacando el reporte
--entonces el consumo de horas debería ser 0
convert(DECIMAL(6,4),(CASE WHEN det.start_date>@FechaCorte THEN 0
--Si la tarea debería estar finalizada entonces tomamos el estimado
WHEN det.finish_date<@FechaCorte THEN DET.USAGE_SUM/3600
--Sino tomamos las asignaciones a la fecha de corte
ELSE ISNULL(SLC_BASE.asignado,0)
END)/100) AvancePlanificado
INTO #TEMP
FROM niku.PRTASK TSK
INNER JOIN niku.INV_INVESTMENTS INV ON (TSK.prprojectid = INV.id and inv.odf_object_code = 'project')
INNER JOIN niku.PRJ_BASELINE_DETAILS DET ON (DET.object_id = tsk.prid
and DET.object_type = 'TASK'
and DET.is_current=1)
--Joineo para obtener la información de programas
LEFT OUTER JOIN (SELECT fla.child_id, inv4.id, inv4.code, inv4.name
FROM niku.inv_flat_hierarchies fla
INNER JOIN niku.INV_INVESTMENTS inv4 on fla.parent_id = inv4.id
WHERE fla.parent_id <> fla.child_id) PROG ON PROG.child_id = inv.id
--Tengo que hacer un OUTER JOIN ya que hay tareas que podrían no estar asignadas a nadie
--Aca obtengo el id de la tarea y el total de horas incurridas
LEFT OUTER JOIN (
SELECT ASG.prtaskid, sum(isnull(TE_SLC.slice,0)) incurridas
FROM niku.PRASSIGNMENT ASG
--PRTIMEENTRY se asocia con la tarea asignada y la TimeSheet de los recursos
LEFT OUTER JOIN niku.PRTIMEENTRY TE on ASG.prid = TE.prassignmentid
LEFT OUTER JOIN niku.PRJ_BLB_SLICES TE_SLC on (TE.prid = TE_SLC.prj_object_id
and TE_SLC.slice_request_id = (
SELECT id
FROM niku.PRJ_BLB_SLICEREQUESTS
WHERE request_name = 'ENTRADAS_DE_TIEMPO_MENSUAL')
)
WHERE TE_SLC.slice >0 and TE.prid IN (
SELECT distinct TENTRY.prid
FROM niku.PRTIMEENTRY TENTRY,
niku.PRTIMESHEET TSHEET
WHERE TENTRY.prtimesheetid = TSHEET.prid
and TSHEET.prstatus = 4
)
--Tomamos las horas reportadas en una fecha determinada
and slice_date < @FechaCorte
GROUP BY ASG.prtaskid
) HORAS ON TSK.prid = HORAS.prtaskid
-- Left Join para obtener las horas asignadas
LEFT JOIN (select ASG.prtaskid prtaskid, SUM(SLC.slice) asignado
from niku.PRASSIGNMENT ASG
left outer join niku.PRJ_BASELINE_DETAILS BLD on bld.object_id = ASG.prid
left outer join niku.PRJ_BLB_SLICES SLC on SLC.prj_object_id = BLD.id
where SLC.slice > 0
and SLC.slice_request_id = 11
and BLD.object_type = 'ASSIGNMENT'
and BLD.is_current = 1
and SLC.slice_date < @FechaCorte
GROUP BY ASG.prtaskid
) SLC_BASE on (SLC_BASE.prtaskid = TSK.prid)
-- Joineamos con las dos tablas de abajo para obtener la línea de servicio del proyecto
LEFT OUTER JOIN niku.ODF_CA_PROJECT INV3 on (INV.id = INV3.id
and INV.odf_object_code = 'project')
LEFT OUTER JOIN niku.CMN_LOOKUPS_V L1 on (L1.lookup_type = 'ITAU_LINEA_SERVICIO'
and INV3.itau_linea_servicio = L1.lookup_code
and L1.language_code = 'es')
WHERE inv.is_active = 1
and pristask = 1 --1 son hojas del WBS, sino es 0
and L1.name in ('Proyecto Pequeño', 'Proyecto Grande')
--Obtener los valores guardados en la tabla temporal para mostrar los resultados por proyecto
select CONVERT(varchar,IdPrograma)+CONVERT(varchar,IdProyecto)+CONVERT(varchar(12),@FechaCorte,112) ID,
IdPrograma, IdProyecto, convert(varchar(30),@FechaCorte,126) Fecha,
SUM(AvancePlanificado) AvancePlanificado,
SUM(HorasIncurridas) Incurrido,
SUM(EV_Calculado) EV,
CASE WHEN isnull(SUM(HorasIncurridas),0) = 0 THEN 0
ELSE SUM(EV_Calculado)/SUM(HorasIncurridas)/100
END CPI_Esfuerzo,
CASE WHEN isnull(SUM(EstimadoBLEnCurso),0) = 0 THEN 0
ELSE SUM(AvancePlanificado)/SUM(EstimadoBLEnCurso)
END PorcPlanificado,
CASE WHEN isnull(SUM(EstimadoBLEnCurso),0) = 0 THEN 0
ELSE convert(DECIMAL(6,4),SUM(EV_Calculado)/SUM(EstimadoBLEnCurso))
END PorcReal,
CASE WHEN isnull(SUM(AvancePlanificado),0) = 0 THEN 0
ELSE convert(DECIMAL(6,4),(SUM(EV_Calculado)/SUM(AvancePlanificado))/100 )
END SPI
From #Temp
Group by IdPrograma, IdProyecto
UNION
--Armar registros que consoliden los programas
select CONVERT(varchar,IdPrograma)+CONVERT(varchar,IdPrograma)+CONVERT(varchar(12),@FechaCorte,112) ID,
IdPrograma, IdPrograma, convert(varchar(30),@FechaCorte,126) Fecha,
SUM(AvancePlanificado) AvancePlanificado,
--replace(SUM(AvancePlanificado),'.',',') AvancePlanificado,
SUM(HorasIncurridas) Incurrido,
SUM(EV_Calculado) EV,
CASE WHEN isnull(SUM(HorasIncurridas),0) = 0 THEN 0
ELSE SUM(EV_Calculado)/SUM(HorasIncurridas)/100
END CPI_Esfuerzo,
CASE WHEN isnull(SUM(EstimadoBLEnCurso),0) = 0 THEN 0
ELSE SUM(AvancePlanificado)/SUM(EstimadoBLEnCurso)
END PorcPlanificado,
CASE WHEN isnull(SUM(EstimadoBLEnCurso),0) = 0 THEN 0
ELSE convert(DECIMAL(6,4),SUM(EV_Calculado)/SUM(EstimadoBLEnCurso))
END PorcReal,
CASE WHEN isnull(SUM(AvancePlanificado),0) = 0 THEN 0
ELSE convert(DECIMAL(6,6),(SUM(EV_Calculado)/SUM(AvancePlanificado))/100)
END SPI
From #Temp
where IdProyecto <> IdPrograma
Group by IdPrograma
ORDER BY IdPrograma
drop table #Temp
]]>
</sql:query>
<core:if test="${p_verbose != '0'}">
<gel:out>[Actualización de EV] Query Ejecutado</gel:out>
<gel:log category="XOG" level="INFO">Query Ejecutado</gel:log>
</core:if>
<!-- HACE LOGIN -->
<!-- ========== -->
<core:catch var="v_xog_exception">
<soap:invoke endpoint="${p_host}/niku/xog" var="auth">
<soap:message>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
<soapenv:Header/>
<soapenv:Body>
<xog:Login>
<xog:Username>${p_XOGUsername}</xog:Username>
<xog:Password>${p_XOGPassword}</xog:Password>
</xog:Login>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
<gel:set asString="true" select="$auth/soapenv:Envelope/soapenv:Body/xog:SessionID/text()" var="sessionID"/>
<core:choose>
<!-- VALIDA QUE EL LOGIN SE HAYA HECHO BIEN -->
<!-- ====================================== -->
<core:when test="${sessionID == null}">
<gel:out>[Actualización de EV] No se pude realizar el Log in. Cheque el usuario y el password.</gel:out>
<gel:log category="XOG" level="ERROR"> No se pude realizar el Log in. Cheque el usuario y el password.</gel:log>
</core:when>
<core:otherwise>
<!-- PARA CADA REGISTRO SE ASIGNAN LAS VARIABLES PARA EL OBJETO -->
<!-- ========================================================== -->
<core:forEach items="${v_query_1.rows}" var="row">
<!-- VARIABLES ASSIGNMENT -->
<core:set var="v_Id">${row.Id}</core:set>
<core:set var="v_IdPrograma">${row.IdPrograma}</core:set>
<core:set var="v_IdProyecto">${row.IdProyecto}</core:set>
<core:set var="v_Fecha">${row.Fecha}</core:set>
<core:set var="v_AvancePlanif">${row.AvancePlanificado}</core:set>
<core:set var="v_Incurrido">${row.Incurrido}</core:set>
<core:set var="v_PorcPlanificado">${row.PorcPlanificado}</core:set>
<core:set var="v_PorcReal">${row.PorcReal}</core:set>
<core:set var="v_EV">${row.EV}</core:set>
<core:set var="v_SPI">${row.SPI}</core:set>
<core:set var="v_CPI_Esfuerzo">${row.CPI_Esfuerzo}</core:set>
<core:if test="${p_verbose != '0'}">
<gel:log category="XOG" level="INFO">Id=${v_Id}</gel:log>
<gel:log category="XOG" level="INFO">Programa=${v_IdPrograma}</gel:log>
<gel:log category="XOG" level="INFO">Proyecto=${v_IdProyecto}</gel:log>
<gel:log category="XOG" level="INFO">Fecha=${v_Fecha}</gel:log>
<gel:log category="XOG" level="INFO">SPI=${v_SPI}</gel:log>
<gel:out>[Actualización de EV] Id=${v_Id}</gel:out>
<gel:out>[Actualización de EV] Programa=${v_IdPrograma}</gel:out>
<gel:out>[Actualización de EV] Proyecto=${v_IdProyecto}</gel:out>
<gel:out>[Actualización de EV] Fecha=${v_Fecha}</gel:out>
</core:if>
<!-- CREACION DE XOG WRITE CON DATOS DEL OBJETO -->
<gel:parse var="xogwrite">
<NikuDataBus
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">
<Header action="write" externalSource="NIKU"
objectType="customObjectInstance"
version="13.1.0.0248">
<args name="overrideAutoNumbering" value="true"/>
</Header>
<customObjectInstances objectCode="itau_hist_ev">
<instance instanceCode="${v_Id}" objectCode="itau_hist_ev">
<CustomInformation>
<ColumnValue name="code">${v_Id}</ColumnValue>
<ColumnValue name="name">Valor Ganado Histórico</ColumnValue>
<ColumnValue name="page_layout">odf.itau_hist_evFrame</ColumnValue>
<ColumnValue name="partition_code">itau_n1_p1</ColumnValue>
<ColumnValue name="itau_fecha">${v_Fecha}</ColumnValue>
<ColumnValue name="itau_id_programa">${v_IdPrograma}</ColumnValue>
<ColumnValue name="itau_id_proyecto">${v_IdProyecto}</ColumnValue>
<ColumnValue name="itau_avance_planif">${v_AvancePlanif}</ColumnValue>
<ColumnValue name="itau_incurrido">${v_Incurrido}</ColumnValue>
<ColumnValue name="itau_ev">${v_EV}</ColumnValue>
<ColumnValue name="itau_spi">${v_SPI}</ColumnValue>
<ColumnValue name="itau_cpi_esfuerzo">${v_CPI_Esfuerzo}</ColumnValue>
<ColumnValue name="itau_porc_esperado">${v_PorcPlanificado}</ColumnValue>
<ColumnValue name="itau_porc_finalizado">${v_PorcReal}</ColumnValue>
</CustomInformation>
</instance>
</customObjectInstances>
</NikuDataBus>
</gel:parse >
<!-- ESCRITURA DEL OBJETO -->
<core:catch var="v_xog_exception">
<soap:invoke endpoint="${p_host}/niku/xog" var="runresult">
<soap:message>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
<soapenv:Header>
<xog:Auth>
<xog:SessionID>${sessionID}</xog:SessionID>
</xog:Auth>
</soapenv:Header>
<soapenv:Body>
<gel:include select="$xogwrite"/>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
</core:catch>
<gel:set asString="true" select="$runresult//Status/@state" var="XOG_STATUS"/>
<gel:set asString="true" select="$runresult//Statistics/@totalNumberOfRecords" var="XOGtotalrecords"/>
<gel:set asString="true" select="$runresult//Statistics/@insertedRecords" var="XOGinsertedrecords"/>
<gel:set asString="true" select="$runresult//Statistics/@updatedRecords" var="XOGupdatedrecords"/>
<gel:set asString="true" select="$runresult//Statistics/@failureRecords" var="XOGfailurerecords"/>
<core:if test="${XOGfailurerecords == '1'}">
<gel:out>[Actualización de EV] <gel:expr select="$runresult"/> </gel:out>
<gel:log category="XOG" level="ERROR"><gel:expr select="$runresult"/> </gel:log>
</core:if>
<core:if test="${p_verbose != '0'}">
<gel:out>[Actualización de EV] <gel:expr select="$runresult"/> </gel:out>
<gel:log category="XOG" level="INFO"><gel:expr select="$runresult"/> </gel:log>
</core:if>
</core:forEach>
</core:otherwise>
</core:choose>
</core:catch>
<core:if test="${v_xog_exception != null}">
<gel:out>[Actualización de EV] Fallo de Proceso: ${v_xog_exception}</gel:out>
<gel:log category="XOG" level="ERROR">Fallo de Proceso: ${v_xog_exception}</gel:log>
</core:if>
<!-- LOGOUT -->
<!-- ====== -->
<soap:invoke endpoint="${p_host}/niku/xog" var="logoutresult">
<soap:message>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
<soapenv:Header>
<xog:Auth>
<xog:SessionID>${sessionID}</xog:SessionID>
</xog:Auth>
</soapenv:Header>
<soapenv:Body>
<xog:Logout/>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
<core:if test="${p_verbose != '0'}">
<gel:out>[Actualización de EV] Fin proceso</gel:out>
<gel:log category="XOG" level="INFO">Fin proceso</gel:log>
</core:if>
</gel:script>