SlideShare una empresa de Scribd logo
1 de 21
Descargar para leer sin conexión
Reporting Services con formato y filtros
(local) o
nombre de PC

Usuario y Clave
de SQL Server

Nombre de la
base de datos
Consulta:
SELECT p.Title As Titulo,
ISNULL(p.FirstName,'')+' '+ISNULL(p.MiddleName,'')+' '+ISNULL(p.LastName,'') AS
NombreCompleto,
pp.PhoneNumber AS Telefono,
ea.EmailAddress AS Email,
a.AddressLine1 AS Direccion,
a.City AS Ciudad,
sp.Name AS Estado,
a.PostalCode AS CodigoPostal,
cr.Name AS Pais
FROM Person.Person AS p
INNER JOIN Person.BusinessEntityAddress AS bea ON bea.BusinessEntityID = p.BusinessEntityID
INNER JOIN Person.Address AS a ON a.AddressID = bea.AddressID
INNER JOIN Person.StateProvince AS sp ON sp.StateProvinceID = a.StateProvinceID
INNER JOIN Person.CountryRegion AS cr ON cr.CountryRegionCode = sp.CountryRegionCode
INNER JOIN Sales.Customer AS c ON c.PersonID = p.BusinessEntityID
LEFT OUTER JOIN Person.EmailAddress AS ea ON ea.BusinessEntityID = p.BusinessEntityID
LEFT OUTER JOIN Person.PersonPhone AS pp ON pp.BusinessEntityID = p.BusinessEntityID
Hasta aquí hemos diseñado el reporte, ahora vamos a darle Formato(color, tamaño)
Insertamos título del reporte
Ahora vamos a pintar de color las filas cuyos títulos sean “Ms.”
Explicación:
=IIf(Fields!Titulo.Value="Ms.","Red","White")
Iif(Condicion,Retorno si es verdadero, Retorno si es verdadero)
Condicion= Fields!NombredelCampo.Value = “Ms”
Color si es verdadero= “Red”
Color si es falso= “White”
Observación: “Ms.” Entre comillas porque es texto, si fuera número no se coloca comillas
Ahora vamos a agregar un filtro: Pais
Primero agregamos un nuevo conjunto de datos
Consulta:
--Los paises estan en la tabla Person.CountryRegion, y su llave primaria es tipo varchar
SELECT NULL AS CodigoPais,
'TODOS' AS Pais
UNION ALL
SELECT CountryRegionCode AS CodigoPais,
Name AS PAIS
FROM Person.CountryRegion
Explicación
El primer registro la consulta tiene como código NULL y de Valor a Mostrar TODOS, el NULL se usara más abajo con la
función COALESCE
UNION ALL se usa para juntar dos Consultas(SELECT) las cuales deben tener los mismos nombres de columnas(
CodigoPais y Pais)
Además tenemos que agregar un parámetro

Ponemos Tipo de Datos Texto porque la clave primaria(PK) de la tabla de Paises(Person.CountryRegion) es tipo
Varchar, si fuera int usar Entero, activamos Permitir NULL
Finalmente modificar la consulta del conjunto de datos “ListaClientes”
SELECT p.Title As Titulo,
ISNULL(p.FirstName,'')+' '+ISNULL(p.MiddleName,'')+' '+ISNULL(p.LastName,'') AS
NombreCompleto,
pp.PhoneNumber AS Telefono,
ea.EmailAddress AS Email,
a.AddressLine1 AS Direccion,
a.City AS Ciudad,
sp.Name AS Estado,
a.PostalCode AS CodigoPostal,
cr.Name AS Pais
FROM Person.Person AS p
INNER JOIN Person.BusinessEntityAddress AS bea ON bea.BusinessEntityID = p.BusinessEntityID
INNER JOIN Person.Address AS a ON a.AddressID = bea.AddressID
INNER JOIN Person.StateProvince AS sp ON sp.StateProvinceID = a.StateProvinceID
INNER JOIN Person.CountryRegion AS cr ON cr.CountryRegionCode = sp.CountryRegionCode
AND cr.CountryRegionCode = COALESCE(@Pais,cr.CountryRegionCode)
INNER JOIN Sales.Customer AS c ON c.PersonID = p.BusinessEntityID
LEFT OUTER JOIN Person.EmailAddress AS ea ON ea.BusinessEntityID = p.BusinessEntityID
LEFT OUTER JOIN Person.PersonPhone AS pp ON pp.BusinessEntityID = p.BusinessEntityID

Explicación:
COALESCE(Parametro1,Parametro2)
Si el Parametro1 es null, se devuelve el Parametro2
Entonces si es NULL la condición seria
AND cr.CountryRegionCode =cr.CountryRegionCode Devuelve todos los paises
Agregamos la columna país al reporte

En vista previa quedara así
Escogemos un país

Espero haber sido lo más claro posible.
Suerte y seguid aprendiendo y compartiendo.

Más contenido relacionado

Último

Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21mariacbr99
 
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptxPROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptxAlan779941
 
Avances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estosAvances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estossgonzalezp1
 
redes informaticas en una oficina administrativa
redes informaticas en una oficina administrativaredes informaticas en una oficina administrativa
redes informaticas en una oficina administrativanicho110
 
Guia Basica para bachillerato de Circuitos Basicos
Guia Basica para bachillerato de Circuitos BasicosGuia Basica para bachillerato de Circuitos Basicos
Guia Basica para bachillerato de Circuitos BasicosJhonJairoRodriguezCe
 
Buenos_Aires_Meetup_Redis_20240430_.pptx
Buenos_Aires_Meetup_Redis_20240430_.pptxBuenos_Aires_Meetup_Redis_20240430_.pptx
Buenos_Aires_Meetup_Redis_20240430_.pptxFederico Castellari
 
How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.FlorenciaCattelani
 
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...JohnRamos830530
 
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptxEVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptxJorgeParada26
 
investigación de los Avances tecnológicos del siglo XXI
investigación de los Avances tecnológicos del siglo XXIinvestigación de los Avances tecnológicos del siglo XXI
investigación de los Avances tecnológicos del siglo XXIhmpuellon
 
Avances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvanaAvances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvanamcerpam
 

Último (11)

Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21
 
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptxPROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
 
Avances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estosAvances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estos
 
redes informaticas en una oficina administrativa
redes informaticas en una oficina administrativaredes informaticas en una oficina administrativa
redes informaticas en una oficina administrativa
 
Guia Basica para bachillerato de Circuitos Basicos
Guia Basica para bachillerato de Circuitos BasicosGuia Basica para bachillerato de Circuitos Basicos
Guia Basica para bachillerato de Circuitos Basicos
 
Buenos_Aires_Meetup_Redis_20240430_.pptx
Buenos_Aires_Meetup_Redis_20240430_.pptxBuenos_Aires_Meetup_Redis_20240430_.pptx
Buenos_Aires_Meetup_Redis_20240430_.pptx
 
How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.
 
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
 
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptxEVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
 
investigación de los Avances tecnológicos del siglo XXI
investigación de los Avances tecnológicos del siglo XXIinvestigación de los Avances tecnológicos del siglo XXI
investigación de los Avances tecnológicos del siglo XXI
 
Avances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvanaAvances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvana
 

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Tutorial Reporting Services

  • 1. Reporting Services con formato y filtros
  • 2.
  • 3. (local) o nombre de PC Usuario y Clave de SQL Server Nombre de la base de datos
  • 4.
  • 5.
  • 6. Consulta: SELECT p.Title As Titulo, ISNULL(p.FirstName,'')+' '+ISNULL(p.MiddleName,'')+' '+ISNULL(p.LastName,'') AS NombreCompleto, pp.PhoneNumber AS Telefono, ea.EmailAddress AS Email, a.AddressLine1 AS Direccion, a.City AS Ciudad, sp.Name AS Estado, a.PostalCode AS CodigoPostal, cr.Name AS Pais FROM Person.Person AS p INNER JOIN Person.BusinessEntityAddress AS bea ON bea.BusinessEntityID = p.BusinessEntityID INNER JOIN Person.Address AS a ON a.AddressID = bea.AddressID INNER JOIN Person.StateProvince AS sp ON sp.StateProvinceID = a.StateProvinceID INNER JOIN Person.CountryRegion AS cr ON cr.CountryRegionCode = sp.CountryRegionCode INNER JOIN Sales.Customer AS c ON c.PersonID = p.BusinessEntityID LEFT OUTER JOIN Person.EmailAddress AS ea ON ea.BusinessEntityID = p.BusinessEntityID LEFT OUTER JOIN Person.PersonPhone AS pp ON pp.BusinessEntityID = p.BusinessEntityID
  • 7.
  • 8.
  • 9. Hasta aquí hemos diseñado el reporte, ahora vamos a darle Formato(color, tamaño)
  • 10.
  • 12. Ahora vamos a pintar de color las filas cuyos títulos sean “Ms.”
  • 13. Explicación: =IIf(Fields!Titulo.Value="Ms.","Red","White") Iif(Condicion,Retorno si es verdadero, Retorno si es verdadero) Condicion= Fields!NombredelCampo.Value = “Ms” Color si es verdadero= “Red” Color si es falso= “White” Observación: “Ms.” Entre comillas porque es texto, si fuera número no se coloca comillas
  • 14. Ahora vamos a agregar un filtro: Pais Primero agregamos un nuevo conjunto de datos
  • 15. Consulta: --Los paises estan en la tabla Person.CountryRegion, y su llave primaria es tipo varchar SELECT NULL AS CodigoPais, 'TODOS' AS Pais UNION ALL SELECT CountryRegionCode AS CodigoPais, Name AS PAIS FROM Person.CountryRegion Explicación El primer registro la consulta tiene como código NULL y de Valor a Mostrar TODOS, el NULL se usara más abajo con la función COALESCE UNION ALL se usa para juntar dos Consultas(SELECT) las cuales deben tener los mismos nombres de columnas( CodigoPais y Pais)
  • 16. Además tenemos que agregar un parámetro Ponemos Tipo de Datos Texto porque la clave primaria(PK) de la tabla de Paises(Person.CountryRegion) es tipo Varchar, si fuera int usar Entero, activamos Permitir NULL
  • 17. Finalmente modificar la consulta del conjunto de datos “ListaClientes”
  • 18.
  • 19. SELECT p.Title As Titulo, ISNULL(p.FirstName,'')+' '+ISNULL(p.MiddleName,'')+' '+ISNULL(p.LastName,'') AS NombreCompleto, pp.PhoneNumber AS Telefono, ea.EmailAddress AS Email, a.AddressLine1 AS Direccion, a.City AS Ciudad, sp.Name AS Estado, a.PostalCode AS CodigoPostal, cr.Name AS Pais FROM Person.Person AS p INNER JOIN Person.BusinessEntityAddress AS bea ON bea.BusinessEntityID = p.BusinessEntityID INNER JOIN Person.Address AS a ON a.AddressID = bea.AddressID INNER JOIN Person.StateProvince AS sp ON sp.StateProvinceID = a.StateProvinceID INNER JOIN Person.CountryRegion AS cr ON cr.CountryRegionCode = sp.CountryRegionCode AND cr.CountryRegionCode = COALESCE(@Pais,cr.CountryRegionCode) INNER JOIN Sales.Customer AS c ON c.PersonID = p.BusinessEntityID LEFT OUTER JOIN Person.EmailAddress AS ea ON ea.BusinessEntityID = p.BusinessEntityID LEFT OUTER JOIN Person.PersonPhone AS pp ON pp.BusinessEntityID = p.BusinessEntityID Explicación: COALESCE(Parametro1,Parametro2) Si el Parametro1 es null, se devuelve el Parametro2 Entonces si es NULL la condición seria AND cr.CountryRegionCode =cr.CountryRegionCode Devuelve todos los paises
  • 20. Agregamos la columna país al reporte En vista previa quedara así
  • 21. Escogemos un país Espero haber sido lo más claro posible. Suerte y seguid aprendiendo y compartiendo.