Вы находитесь на странице: 1из 11

Manual de Programacin

Resumido de Hyperion

Bision Technology
Capacita@bision.cl
1. Programacin
Consideraciones de Programacin

En este curso se aplicaran cada uno de los cdigos descritos a continuacin su aplicacin a travs de
ejemplos de didcticos permitir a cada alumno poder desarrollar cualquier documento a partir de este set
de cdigos

Comentarios de Columnas

// comment out a line


/* comment out
several lines
*/

********************************************************************************

Booleanos

Use true or false.


Example: ActiveDocument.Sections[Results].Visible = false;

********************************************************************************

Operadores

Comparison operators return a Boolean value (true or false)

== Equal
!= Not equal
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to

Bision Technology
Capacita@bision.cl
Operadores Lgicos

Enables you to combine comparison operators.

&& And - both operands must be true


|| Or - one operand must be true

********************************************************************************

Manejo de del IF

Sintaxis:

if ( name == "Mark")
{
Alert("Hello Mark");
}
else
{
Alert("Goodbye");
}

********************************************************************************
Llenar un cuadro despegable

ActiveDocument.Sections["Resultados"].Limits[1].RefreshAvailableValues()
var llenar =ActiveDocument.Sections["Resultados"].Limits[1].AvailableValues.Count;
Despegable.RemoveAll();
Despegable.Add("- Todos -")
for(i=1;i<=llenar;i++)
{Despegable.Add(ActiveDocument.Sections["Resultados"].Limits[1].AvailableValues[i])
}

********************************************************************************
Seleccionar Opciones de un Cuadro despegable

ActiveDocument.Sections["Resultados"].Limits[1].RefreshAvailableValues()
var
choice=ActiveDocument.Sections["EIS"].Controls.Despegable[Despegable.SelectedIndex]
if (choice == "- Todos -")
{ActiveDocument.Sections["Resultados"].Limits[1].SelectedValues.AddAll()}
else
{ActiveDocument.Sections["Resultados"].Limits[1].SelectedValues.Add(choice)}

********************************************************************************

Bision Technology
Capacita@bision.cl
Llenar una Lista

ActiveDocument.Sections["Resultados"].Limits[1].RefreshAvailableValues()
llenar=ActiveDocument.Sections["Resultados"].Limits[1].AvailableValues.Count
Lista.RemoveAll()
Lista.Add("-Todos-")
for(i=1;i<=llenar;i++)
{Lista.Add(ActiveDocument.Sections["Resultados"].Limits[1].AvailableValues[i])}

********************************************************************************

Seleccionar Opciones de una Lista

var
uno= Lista.SelectedList.Item(1)
if (uno =="-Todos-")
{
ActiveDocument.Sections["Resultados"].Limits[1].SelectedValues.AddAll()}
else
{
contar = Lista.SelectedList.Count
if (contar !=0)
{
ActiveDocument.Sections["Resultados"].Limits[1].RefreshAvailableValues()
caja = new Array(contar)
for (i=1;i<=contar;i++)
{choice = Lista.SelectedList.Item(i)
caja[i] = choice}
for (i=1;i<=contar;i++)
{ActiveDocument.Sections["Resultados"].Limits[1].SelectedValues.Add(caja[i])
}
}
}

********************************************************************************
Activar una seccin

ActiveDocument.Sections["Seccion"].Activate()

********************************************************************************
Imprimir un Reporte

ActiveDocument.Sections["Seccion"].PrintOut()

*******************************************************************************

Bision Technology
Capacita@bision.cl
Exportar una seccin

ActiveDocument.Sections["Seccion"].Export()

********************************************************************************
Procesar Consultas

ActiveDocument.Sections["Consulta"].Process()

*******************************************************************************

Conectar a una Base de Datos

MyConnection = ActiveDocument.Sections["Consulta"].DataModel.Connection
MyConnection.Open("C:\\brio.oce")
MyConnection.Username = "usuario"
MyConnection.SetPassword('password')
MyConnection.Connect()

********************************************************************************
Esconder barras de herramientas

Toolbars[1].Visible= false
Toolbars[2].Visible=false
Toolbars[3].Visible=false
Toolbars[4].Visible=false
Application.ShowMenuBar =false
ActiveDocument.ShowCatalog=false
ActiveDocument.ShowSectionTitleBar=false

********************************************************************************

Cdigo para procesar un procedimiento almacenado

nom = nom1.Text
fec = fecha1.Text
doc = doc1.text
job = job1.text

// los valores deben ser rescatados desde donde se encuantren tales valores
// en el caso del nombre del usuario el cdigo debera ser
// nom = Documents["Menu"].Sections["Inicio"].Shapes["user"].Text
// el documento deberia ser
// doc = Documents["Menu"].Name
// y el job, q es el trabajo q realiza el usuario, deberia ser

Bision Technology
Capacita@bision.cl
// job = "Exportar vtas mensual por cliente"

ActiveDocument.Sections["Consulta"].SetStoredProcParam(""+nom+ "" ,1)


ActiveDocument.Sections["Consulta"].SetStoredProcParam(""+fec+ "" ,2)
ActiveDocument.Sections["Consulta"].SetStoredProcParam(""+doc+ "" ,3)
ActiveDocument.Sections["Consulta"].SetStoredProcParam(""+job+ "" ,4)
ActiveDocument.Sections["Consulta"].ProcessStoredProc()

********************************************************************************

PROCESA APPEND-QUERIES

var
anio=ao.Text
ActiveDocument.Sections["CONSULTA"].AppendQueries["VENTAS"].Limits[1].CustomValues.RemoveAll()
ActiveDocument.Sections["CONSULTA"].AppendQueries["VENTAS"].Limits[1].CustomValues.Add(anio)
ActiveDocument.Sections["CONSULTA"].AppendQueries["VENTAS"].Limits[1].SelectedValues.AddAll()

********************************************************************************

Cambiar Lmite ingresando valor en texto

var choice=ActiveDocument.Sections["EIS"].Shapes["ao"].Text
ActiveDocument.Sections["Resultados"].Limits[1].CustomValues.RemoveAll()
ActiveDocument.Sections["Resultados"].Limits[1].CustomValues.Add(choice)
ActiveDocument.Sections["Resultados"].Limits[1].SelectedValues.AddAll()

********************************************************************************

AGREGAR ROTULOS LATERALES A UN PIVOT

ActiveDocument.Sections["Pivot"].SideLabels["Tipo De Artculo"].Remove()
ActiveDocument.Sections["Pivot"].SideLabels.Add("Tipo Establecimiento")

********************************************************************************

REMOVER ROTULOS LATERALES DE UN PIVOT

ActiveDocument.Sections["EIS"].SideLabels["Tipo De Artculo"].Remove()
ActiveDocument.Sections["EIS"].SideLabels["Tipo Establecimiento"].Remove()

********************************************************************************

AGREGAR TOTALES Y AUTO-AJUSTAR COLUMNAS A UN PIVOT

ActiveDocument.Sections["Pivot"].SideLabels["Tipo Establecimiento"].Totals.Add()
ActiveDocument.Sections["Pivot"].SideLabels["Tipo Establecimiento"].AutoSizeWidth()

Bision Technology
Capacita@bision.cl
********************************************************************************

EXPORTAR SECCIONES A EXCEL LAS SECCIONES DEL INFORME

var objExcel = new JOOLEObject("Excel.Application");


objExcel.Workbooks.Add;
var objBook = objExcel.Workbooks.Item(1);
var objSheets = objBook.Sheets;
var objCurrentSheet = objSheets.Item(1);
var objCells = objCurrentSheet.Cells;

//**************++++++ Aca va un titulo que se pega en el excel


objExcel.Rows.Range("b2").activate
objExcel.Rows.Range("b2").Value= "GESTION GERENCIAL CALL CENTER"
objExcel.Rows.Range("b2").Font.Name = "Verdana"
objExcel.Rows.Range("b2").Font.Bold = 1
objExcel.Rows.Range("b2").Font.Italic = 1
objExcel.Rows.Range("b2").Font.Size= 11

/*
objExcel.Rows.Range("b3").activate
//objExcel.Rows.Range("b3").Value= tit1.Text
objExcel.Rows.Range("b3").Font.Name = "Verdana"
objExcel.Rows.Range("b3").Font.Bold = 1
objExcel.Rows.Range("b3").Font.Italic = 1
objExcel.Rows.Range("b3").Font.Size= 10
*/

pegatabla("T1", 4)
pegatabla("T2", 10)
pegatabla("T3", 25)

pegagrafico("G2",4,7)

/*
pegatabla("T3", 40)
pegatabla("T4", 60)
pegatabla("T5", 80)
pegatabla("T6", 100)
pegatabla("T7", 120)

Bision Technology
Capacita@bision.cl
*/

objExcel.Visible = true

function pegagrafico(grafico, col,fila)


{
ActiveDocument.Sections[grafico].Copy()
objCells.Item(fila,col).PasteSpecial
}

function pegatabla(pivot, posicion)


{
ActiveDocument.Sections[pivot].Copy()
var inicio = "a" + posicion
objExcel.Rows.Range(inicio).PasteSpecial[ -4163 ]
pivotRows = objExcel.Selection.Rows.Count
pivotColumns = objExcel.Selection.Columns.Count

for(i=0+posicion;i<pivotRows+posicion;i++)
{
objCells.Item(1,i).Interior.colorindex=15
for(j=1;j<=pivotColumns;j++)
{
if(i==posicion)
{
objCells.Item(j,posicion).Interior.colorindex=15
}
objCells.Item(j,i).Font.Name = "Verdana"
objCells.Item(j,i).Font.Size= 7
objCells.Item(j,i).Borders.LineStyle = 1
if(objCells.Item(j,i).Value=="?")
objCells.Item(j,i).Font.Color= -16776961
if(objCells.Item(j,i).Value=="?")
objCells.Item(j,i).Font.Color= -11489280
}
}
}

********************************************************************************

Bision Technology
Capacita@bision.cl
CAMBIAR HECHOS EN UN GRAFICO

var
stock = ActiveDocument.Sections["EIS"].Shapes["stock_mes"].Text
ActiveDocument.Sections["Grafico"].Facts.Add(stock)

********************************************************************************
CAMBIAR NOMBRE FISICO A UNA TABLA

var
uno="Tabla Articulos"
ActiveDocument.Sections["Consulta"].DataModel.Topics["planta"].PhysicalName=uno
ActiveDocument.Sections["Consulta"].DataModel.SyncWithDatabase()

********************************************************************************

CAMBIAR JOINS O RELACIONES DE UNA CONSULTA

ActiveDocument.Sections["Consulta"].DataModel.Joins.RemoveAll()
var
a=ActiveDocument.Sections["Consulta"].DataModel.Topics["Clientes"].TopicItems.Item(1)
b=ActiveDocument.Sections["Consulta"].DataModel.Topics["VENTAS"].TopicItems.Item(2)
ActiveDocument.Sections["Consulta"].DataModel.Joins.Add(a,b,bqJoinSimpleEqual)

********************************************************************************
INSERTAR VALORES EN UNA COLUMNA EN TABLA RESULTADOS

valor=ActiveDocument.Sections["INICIO"].Shapes["Valor Dolar"].Text
lugar=ActiveDocument.Sections["Resultados"].Columns["Valor Dolar"].Index
ActiveDocument.Sections["Resultados"].Columns.ModifyComputed(lugar,"'"+valor+"'")

********************************************************************************

CREAR LIMITES EN UNA CONSULTA

var
factual = fecha.Text
ActiveDocument.Sections["Consulta"].Limits.RemoveAll()
MyLimit = ActiveDocument.Sections["Consulta"].Limits.CreateLimit("Clientes.Mes_de_Proceso")
MyLimit.Operator = bqOperatorEqual
MyLimit.CustomValues.Add(factual)
MyLimit.SelectedValues.Add(factual)
ActiveDocument.Sections["Consulta"].Limits.Add(MyLimit)

********************************************************************************

Bision Technology
Capacita@bision.cl
INSTRUCCION CASE

var ReturnVal =0
ReturnVal = Alert("SELECCIONE UNA OPCION. ","Proyecto","IMPRIMIR INFORME","VISUALIZAR
INFORME","VOLVER")
switch (ReturnVal)
{
case 1:
ActiveDocument.Sections["Informe"].PrintOut()

break;
case 2:
ActiveDocument.Sections["Informe"].Activate()

break;

default:
break;
}

********************************************************************************

Cerrar un documento

ActiveDocument.Close()

********************************************************************************

Mensaje de Alerta

Alert("Debe Seleccionar una Empresa";"ALERTA")

********************************************************************************

Salir de Brioquery
Application.Quit()

********************************************************************************

Bision Technology
Capacita@bision.cl
Para enviar un correo mediante Brio

var ol = new JOOLEObject("Outlook.Application")


var msg = ol.CreateItem(0)
//Optional line below to make the message visible
msg.Display()
msg.To = "cristian.arevalo@age.cl"
msg.Subject = "Report"
msg.Attachments.Add("C:\\myreport.pdf")
msg.Send()

********************************************************************************

Enviar un mensaje con el nmero de registro de la consulta

if (ActiveDocument.Sections["Results"].RowCount == 0)
{
Application.Alert("No Records Found");
}
else
{
Application.Alert (ActiveDocument.Sections["Results"].RowCount + " Records Returned");
}

Trabajo con la Consola

Bision Technology
Capacita@bision.cl

Вам также может понравиться