Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI, I HAVE A PROBLEM!!
I NEED DO A COMPARATIVE OF 5 YEARS BEFORE IN A TABLE FROM AN ESTADISTIC YEAR TAKEN. WELL IF AI HAVENT SELECTIONS IT WORKS FINE BUT IF A SELECT A YEAR ONLY SHOWS THE DATES OF THAT YEAR AND NOT THE YEARS BEFORE. HOW CAN I DO THIS?
//EXPRESSION OF A TABLE
EXPR1 =SUM(IF(AÑOESTADISTICO=vAÑOEST,IF(LHNUL=1,LHUN1)))
EXPR2 =SUM(IF(AÑOESTADISTICO=vAÑOEST-2,IF(LHNUL=1,LHUN1)))
.
.
EXPR5 =SUM(IF(AÑOESTADISTICO=vAÑOEST-5,IF(LHNUL=1,LHUN1)))
//EDIT MODULE
Sub Comparativa5prueba
set v = ActiveDocument.GetVariable("vAÑOEST")
if isnull(ActiveDocument.Fields("AÑOESTADISTICO")) Then
v.SetContent year(now()), true
else
set vaest = ActiveDocument.Fields("AÑOESTADISTICO").GetSelectedValues
if vaest.Count <>0 then
v.SetContent vaest.item(0).text,true //TRY GET THE FIRST ELEMENT
else
v.SetContent year(now()), true
end if
End If
end sub
/**********************/
IF NO SELECTIONS I HAVE THIS
Código || Mercacía || 2010 || 2009 || .. || 2005
datos datos datos datos .. datos
.
.
Else if i select a date like 2008 i have:
Código || Mercacía || 2008 || 2009 || .. || 2003
datos datos datos 0 0 0
.
.
Thanks.
Hi
Well, i try this in my script and seems that it works:
ActiveDocument.Fields("AÑOESTADISTICO").ToggleSelect (v.GetContent.string-1)
ActiveDocument.Fields("AÑOESTADISTICO").ToggleSelect (v.GetContent.string-2)
ActiveDocument.Fields("AÑOESTADISTICO").ToggleSelect (v.GetContent.string-3)
ActiveDocument.Fields("AÑOESTADISTICO").ToggleSelect (v.GetContent.string-4)
ActiveDocument.Fields("AÑOESTADISTICO").ToggleSelect (v.GetContent.string-5)
With this the others fields works, so i think that my problem is solved.
Thanks
Hi again:
I think that a posible solution can be select the 4 dates before from a my selection.
How can i do it please?
if i select 2009 in AÑOESTADISTICO (column of main table) (for X=2009)
the function must select too X-1 and X-2 .. X-5.
Maybe if i doing this my script works.
Can help me?
Hi
Well, i try this in my script and seems that it works:
ActiveDocument.Fields("AÑOESTADISTICO").ToggleSelect (v.GetContent.string-1)
ActiveDocument.Fields("AÑOESTADISTICO").ToggleSelect (v.GetContent.string-2)
ActiveDocument.Fields("AÑOESTADISTICO").ToggleSelect (v.GetContent.string-3)
ActiveDocument.Fields("AÑOESTADISTICO").ToggleSelect (v.GetContent.string-4)
ActiveDocument.Fields("AÑOESTADISTICO").ToggleSelect (v.GetContent.string-5)
With this the others fields works, so i think that my problem is solved.
Thanks