Select distinct values for ssrs sharepoint parameter
hi,
I need distinct selected values for parameter dropdown in shaepoint ssrs. Everrything will work fine if i select value and label field same field like(Location_Code). But i need value field to be different field (LocationID). like (dropdown id in value field
and text as lable field)
Because i am using value field in record filtering.
Any suggestions?
Thanks Manohara R
Hi Manohar,
Pls check the lin
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/6495db18-a1c1-480b-8c92-89c74ee47cf5/how-to-get-distinct-values-of-sharepoint-column-using-ssrs?forum=sqlreportingservices
Please remember to click 'Mark as Answer' on the answer if it helps you
Similar Messages
-
Need of SQL query in selecting distinct values from two tables
hi,
I need a query for selecting distinct values from two tables with one condition.
for eg:
there are two tables a & b.
in table a there are values like age,sex,name,empno and in table b valuses are such as age,salary,DOJ,empno.
here what i need is with the help of empno as unique field,i need to select distinct values from two tables (ie) except age.
can anybody please help me.
Thanks in advance,
RatheeshNot sure what you mean either, but perhaps this will start a dialog:
SELECT DISTINCT a.empno,
a.name,
a.sex,
b.salary,
b.doj
FROM a,
b
WHERE a.empno = b.empno;Greg -
How to get the list of values for a dynamic parameter using Web Services SDK?
<p>I am struggling to get the list of values for a dynamic parameter of a report.</p><p>I am using Java Web Services SDK ... I tried to use PromptInfo.getLOV().getValues() method but it does not work.</p><p>First of all ... is this possible (to get the list of values for a dynamic param) using Web Services?</p><p>Second of all, if this is possible, how should I do it ... it seems it works fine when running the report from CMC. It asks for DB logon info and after that it provides a list of values.</p><p>Thx </p>
<p>Your assumption is correct. We are trying to get the LOVs from the Crystal Report. I was not aware that this is not supported by Web Services SDK.</p><p>We used Web Services SDK to integrated the Crystal Reports in our web application. We implemented some basic actions for reports: schedule, view instances, run ad-hoc reports.</p><p>We encountered this problem when trying to run/schedule reports with dynamic parameters (a list of values from DB). We were unable to get the LOVs.</p><p>Please let me know if you can think of an alternative to look at.</p><p>Thanks a lot,</p><p>Catalin </p>
-
How to select XML value for a namespace when multiple namespaces
Hi,
I'm a beginner with this, but I'm doing well with your help from this forum in a recent post selecting out all the detail from my xml
out into my oracle relational tables. Stumped, though, on how to select a value for xml tag value referenced by a defined namespace.
Version, XML, what I want to select, and attempted sql is below. Thanks in advance!
select * from V$VERSION
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
drop table TRANSCRIPT;
create table TRANSCRIPT (
CONTENT xmltype
<?xml version="1.0" encoding="UTF-8"?>
<arb:AcademicRecordBatch xmlns:arb="urn:org:pesc:message:AcademicRecordBatch:v1.0.0">
<hst:HighSchoolTranscript xmlns:hst="urn:org:pesc:message:HighSchoolTranscript:v1.0.0" xmlns:ct="http://ct.transcriptcenter.com">
<TransmissionData>
<DocumentID>2013-01-02T09:06:15|D123456789</DocumentID>
</TransmissionData>
<Student>
<Person>
<Name>
<FirstName>John</FirstName>
<LastName>Doe</LastName>
</Name>
</Person>
<AcademicRecord>
<AcademicSession>
<Course>
<CourseTitle>KEYBOARD 101</CourseTitle>
<UserDefinedExtensions>
<ct:TranscriptExtensions>
<NCESCode>01001E010456</NCESCode>
<CourseRigor>1</CourseRigor>
</ct:TranscriptExtensions>
</UserDefinedExtensions>
</Course>
<Course>
<CourseTitle>SCIENCE 101</CourseTitle>
<UserDefinedExtensions>
<ct:TranscriptExtensions>
<NCESCode>01001E010457</NCESCode>
<CourseRigor>2</CourseRigor>
</ct:TranscriptExtensions>
</UserDefinedExtensions>
</Course>
</AcademicSession>
<AcademicSession>
<Course>
<CourseTitle>MATH 201</CourseTitle>
<UserDefinedExtensions>
<ct:TranscriptExtensions>
<NCESCode>01001E010458</NCESCode>
<CourseRigor>2</CourseRigor>
</ct:TranscriptExtensions>
</UserDefinedExtensions>
</Course>
</AcademicSession>
</AcademicRecord>
</Student>
</hst:HighSchoolTranscript>
</arb:AcademicRecordBatch>I want to be able to select the NESCODE associated to each coursetitle (01001E010456, 01001E010457, 01001E010458), with NESCode defined by namespace, but getting out NULL.
DOCUMENTID LASTNAME COURSETITLE NCESCODE
2013-01-02T09:06:15|D123456789 Doe KEYBOARD 101
2013-01-02T09:06:15|D123456789 Doe SCIENCE 101
2013-01-02T09:06:15|D123456789 Doe MATH 201
My SQL is below. You'll see where I commented out a couple failed alternatives too. Thanks again in advance for any guidance.
select x0.DocumentID
,x1.LastName
, x3.CourseTitle
,x3.NCESCode
from TRANSCRIPT t
, xmltable(
xmlnamespaces(
'urn:org:pesc:message:AcademicRecordBatch:v1.0.0' as "ns0"
, 'urn:org:pesc:message:HighSchoolTranscript:v1.0.0' as "ns1"
--, 'http://ct.transcriptcenter.com' as "ns1b"
, '/ns0:AcademicRecordBatch/ns1:HighSchoolTranscript'
passing t.content
columns DocumentID varchar2(40) path 'TransmissionData/DocumentID'
, Student xmltype path 'Student'
) x0
, xmltable(
'/Student'
passing x0.Student
columns LastName varchar2(20) path 'Person/Name/LastName'
,AcademicRecord xmltype path 'AcademicRecord'
) x1
, xmltable(
'/AcademicRecord/AcademicSession'
passing x1.AcademicRecord
columns GradeLevel varchar2(20) path 'StudentLevel/StudentLevelCode'
, Courses xmltype path 'Course'
) x2
, xmltable(
xmlnamespaces('http://ct.transcriptcenter.com' as "ns2b")
, '/Course'
passing x2.Courses
columns CourseTitle varchar2(40) path 'CourseTitle'
,NCESCode varchar2(20) path 'UserDefinedExtensions/ns2b:ct/NCESCode'
--,NCESCode varchar2(20) path 'UserDefinedExtensions/ns2b:ct/TranscriptExtensions/NCESCode'
) x3
<<I'm assuming there is more to your XML than you showed, since
StudentLevel/StudentLevelCode
is not in the XML, but is in your query. >>
Yes, to simplify, I left out some of the additional XML data, which is typically present, sorry for any confusion. I should have removed those references to that data in my example which was failing to retrieve the NCESCode data which was denoted by that namespace.
Thank you very much! Your correction worked. I was not understanding until your correction how to properly reference in the XPATH for that namespace value. I'm a newbie at this, and this is my second post. But I've been able to populate quite a few relational tables and that was the first of several namespace tags I will have to deal with next, and with that help, I should be good with that syntax now.
Thanks again for your help on this. -
The "SignFile" task was not given a value for the required parameter "CertificateThumbprint"
We have a line of business app which is deployed via clickonce. I can build and publish the application without any problems but when I try to use Continuous Integration (Build each check-in) I get the following error:
2>C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(3450,5):
error MSB4044:
The "SignFile" task was not given a value for the required parameter "CertificateThumbprint".
[C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse\Pulse.csproj]
Done executing task "SignFile" -- FAILED.
We sign the application (to be more specific: the ClickOnce manifest) using a code signing certificate which is registered in the AD as Trusted Publisher.
The Certificate is stored in Certificate store on my local workstation. The Certificate is also in the certificate store of the build server (1. In the Personal Store, 2. in the Personal store of the TFSBuildServiceHost Service Account and 3. in the Personal
store of the tfs/build server itself).
Where are using Visual Studio 2013 Update 4, C#, .Net 4.5 and TFS 2013 Update 4.
I have no clue what causes this error, any help is appreciated.I installed the
Windows Software Development Kit (SDK) for Windows 8 and now I can build the solution via command line.
"C:\Program Files (x86)\MSBuild\12.0\bin\amd64\MSBuild.exe" C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse.sln
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse.sln
But the TFS Build still fails.
Here is the error output gathered from the tfsbuild logfile:
Task "AL"
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\AL.exe /culture:de /out:obj\Debug\de\Pulse.resources.dll /platform:AnyCPU /template:obj\Debug\Pulse.exe /embed:obj\Debug\Pulse.View.Localization.CreditsView.de.resources /embed:obj\Debug\Pulse.View.Localization.PulseMainWindow.de.resources
Microsoft (R) Assembly Linker version 12.0.20806.33440
Copyright (C) Microsoft Corporation. All rights reserved.
Done executing task "AL".
2>Done building target "GenerateSatelliteAssemblies" in project "Pulse.csproj".
2>Target "CreateSatelliteAssemblies" in file "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets" from project "C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse\Pulse.csproj" (target "CoreBuild" depends on it):
2>Done building target "CreateSatelliteAssemblies" in project "Pulse.csproj".
Target "SetWin32ManifestProperties" skipped. Previously built successfully.
Target "_DeploymentComputeNativeManifestInfo" skipped, due to false condition; ('$(GenerateClickOnceManifests)'!='true') was evaluated as ('true'!='true').
2>Target "CleanPublishFolder" in file "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets" from project "C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse\Pulse.csproj" (target "_DeploymentComputeClickOnceManifestInfo" depends on it):
Task "RemoveDir" skipped, due to false condition; ('$(PublishDir)'=='$(OutputPath)app.publish\' and Exists('$(PublishDir)')) was evaluated as ('bin\Debug\app.publish\'=='bin\Debug\app.publish\' and Exists('bin\Debug\app.publish\')).
2>Done building target "CleanPublishFolder" in project "Pulse.csproj".
Target "_DeploymentGenerateTrustInfo" skipped, due to false condition; ('$(TargetZone)'!='') was evaluated as (''!='').
2>Target "_DeploymentComputeClickOnceManifestInfo" in file "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets" from project "C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse\Pulse.csproj" (target "GenerateApplicationManifest" depends on it):
Task "Copy"
Creating directory "bin\Debug\app.publish".
Copying file from "obj\Debug\Pulse.exe" to "bin\Debug\app.publish\Pulse.exe".
Done executing task "Copy".
Using "SignFile" task from assembly "Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "SignFile"
2>C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(3450,5): error MSB4044: The "SignFile" task was not given a value for the required parameter "CertificateThumbprint". [C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse\Pulse.csproj]
Done executing task "SignFile" -- FAILED.
2>Done building target "_DeploymentComputeClickOnceManifestInfo" in project "Pulse.csproj" -- FAILED.
2>Target "_CheckForCompileOutputs" in file "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets" from project "C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse\Pulse.csproj" (target "_CleanGetCurrentAndPriorFileWrites" depends on it):
2>Done building target "_CheckForCompileOutputs" in project "Pulse.csproj".
Target "_SGenCheckForOutputs" skipped, due to false condition; ('$(_SGenGenerateSerializationAssembliesConfig)' == 'On' or ('@(WebReferenceUrl)'!='' and '$(_SGenGenerateSerializationAssembliesConfig)' == 'Auto')) was evaluated as ('Off' == 'On' or (''!='' and 'Off' == 'Auto')).
2>Target "_CleanGetCurrentAndPriorFileWrites" in file "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets" from project "C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse\Pulse.csproj" (target "_CleanRecordFileWrites" depends on it):
Task "ReadLinesFromFile"
Done executing task "ReadLinesFromFile".
Task "ConvertToAbsolutePath"
Done executing task "ConvertToAbsolutePath".
Task "FindUnderPath"
Comparison path is "C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse".
Done executing task "FindUnderPath".
Task "FindUnderPath"
Comparison path is "C:\Builds\1\Pulse\DefaultBuild\bin\".
Done executing task "FindUnderPath".
Task "FindUnderPath"
Comparison path is "obj\Debug\".
Done executing task "FindUnderPath".
Task "RemoveDuplicates"
Done executing task "RemoveDuplicates".
2>Done building target "_CleanGetCurrentAndPriorFileWrites" in project "Pulse.csproj".
2>Target "_CleanRecordFileWrites" in file "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets" from project "C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse\Pulse.csproj" (target "CoreBuild" depends on it):
Task "RemoveDuplicates"
Done executing task "RemoveDuplicates".
Task "MakeDir"
Done executing task "MakeDir".
Task "WriteLinesToFile"
Done executing task "WriteLinesToFile".
2>Done building target "_CleanRecordFileWrites" in project "Pulse.csproj".
2>Done Building Project "C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse\Pulse.csproj" (default targets) -- FAILED.
1>Done executing task "MSBuild" -- FAILED.
1>Done building target "Build" in project "Pulse.sln" -- FAILED.
1>Done Building Project "C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse.sln" (default targets) -- FAILED.
Build FAILED.
"C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse.sln" (default target) (1) ->
"C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse\Pulse.csproj" (default target) (2) ->
(_DeploymentComputeClickOnceManifestInfo target) ->
C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets(3450,5): error MSB4044: The "SignFile" task was not given a value for the required parameter "CertificateThumbprint". [C:\Builds\1\Pulse\DefaultBuild\src\Pulse\Pulse\Pulse.csproj]
0 Warning(s)
1 Error(s) -
NW04s(SP7/FEP7)-Select Filter value for HIER in 3.XBexAnalyzer doesn't work
Hi,
We went live with SPS 7/FEP 7 and we are having problem in 3.X Bex Analyzer with "Select Filter Value" for charcteristic having active hierarchy(in this case it is using time dependent hierarchy). (For Eg: Organization Unit)
If I inactivate the hierarchy for organization unit at query level and then execute the query, then "select filter value" works for Organization Unit.
NOTE: I checked other query using hierarchy (not time dependent hierarchy) and I was able to do "select filter value"
Please let me know if any OSS note is available for this issue so that we can fix this issue in our Production Environment.
NOTE: The above issue works in SPS 8/FEP 802 with 3.X Bex Analyzer.
Thankyou,
-Sini
Message was edited by: Sini KumarHi,
Did you have an asnwer to your problem?
We've a similar problem we had a technical upgrade to BI 7.0. But we still work with the frond end tools of 3.5.
When we select in the Bex analyzer a node in an hierarchy it shows the result, but if want to select an other node we must first remove the old filter. This wasn't when we're on the 3.5 enviroment.
Maybe if the problem is solved, this can help us.
Thanks in advance!
Regards,
Juriaan -
How to pass multiple MDX values for a single parameter into a drill-through report?
I'm thinking this will be an easy question for any experienced SSRS/MDX developers, at least I hope so! I've created a report that gives the user the option to choose viewing data for the current/active week, or YTD. Depending on which link the
user selects, the report simply calls itself and needs to pass in the parameter value for Active week. If it's active week, the parameter value will simply be "true". If it's YTD, the parameter value needs to be both "True" and "False" so the current
week's data is accounted for as well. I've set everything up except for the final step, and I have no idea what to type into the Value field below. I've tried different things: false, as you see below (it errors saying I'm missing the parameter
value), the value in MDX format: =[School Dates].[Active Week].&[True] (it said I was missing a bracket), a 1 instead of the word true (again, missing a parameter value). Nothing is working.
So my question is kindof two-fold: 1) how do you pass in the value at all and 2) more specifically, how do you pass in multiple values (both true & false) ??I'm sorry for being so dense, but I'm not quite following, although what I've tried makes me think if I can follow you, it will work :)
To answer your initial questions, you are correct with both your assumptions:
1) detailType is the parameter that specificies YTD/Weekly, this is a "report defined" parameter that I am using to determine which Row Group to display (either YTD or Weekly)
2) SchoolDaysActiveWeek is the parameter that is being set to either true or false -- this is a field in the cube that states whether that record is for the current week or not
So in following your instructions, well that's the problem I'm not quite following :)
1) When you say Delete the SchoolDaysActiveWeek parameter from the report only, do you mean to mark the parameter as Hidden? If so, I've done this.
2) I'm not quite sure where to use the statement you provided me. You said to put it in the dataset, but I don't know which dataset. I assume you mean the "main" dataset (as opposed to the hidden dataset that gets generated when you mark a field
as a parameter). If this is the case, the only place I could see that would allow you to use such a statement is in the Filter section of the properties. I tried this, and it did not generate any errors, but it also kept my report groups from displaying
-- it just showed a blank report, so I think it probably wasn't bringing back any rows to populate them with.
I also tried going into the Expression section for the SchoolDaysActiveWeek parameter in the second screenshot and placing the statement there. When I did this and ran the report, I would get the following error:
The 'SchoolDaysActiveWeek' parameter is missing a value
So what am I missing!?
Also, thanks for taking the time to respond!! -
How to select distinct values from a table when it has composite primary ke
Hi
I have the requirement like , I need to select distinct one column values from the table which has composite primary key. How to acheive this functioinality using view object.
Eg : Table 1 has col1 and col2, col3
col1 col2 col3
1 A NA
1 B NA
2 A NA
3 C NA
2 D NA
primary key (col1,col2)
I have to select distinct col1.
ThanksHi
I got the solution for above. By Creating the read only view object we can acheive this.
thanks -
How to choose optimal value for the OPEN_CURSOR parameter in init.ora?
15:05:35 SQL> select count(*) from v$open_cursor;
COUNT(*)
5159
15:06:28 SQL> select count(*) from v$open_cursor WHERE user_name='USER1';
COUNT(*)
2369
15:06:48 SQL> select count(*) from v$open_cursor WHERE user_name='USER2';
COUNT(*)
686
Currently, application using these number of open cursors?
How to set the optimal value for this application?Hi,
>>With the above setting I have yet to get any errors due to cursor limits. A good trade off memory v issues.
To see if you have set OPEN_CURSORS high enough, monitor v$sesstat dynamic performance view using the SQL below for the maximum opened cursors. If your sessions are running close to the limit, maybe you should increase the value of OPEN_CURSORS.
select max(a.value) as highest_open_cur, p.value as max_open_cur
from v$sesstat a, v$statname b, v$parameter p
where a.statistic# = b.statistic#
and b.name = 'opened cursors current'
and p.name= 'open_cursors'
group by p.value;In addition, I advise you to take a look at your PL/SQL code in order to see if the explicit cursors have been close (if it was the case), or if your SQL code can be tuned ...
Cheers
Legatti -
Oracle UCM distinct values for attribute in GET_SEARCH_RESULTS ResultSet
hi, can anyone, please, tell if there is a way to get a distinct values of resultset of GET_SEARCH_RESULTS?
I mean, is it possible to obtain distinct values with custom where values of attribute through api?
I need to build somewhat like autosuggest feature, but afaik there is no such service.
Alternatives are
- build my own service which can accept query text, pass it to GET_SEARCH_RESULTS, get results, calculate distinct and output it in hda - i dont like this idea, becouse it means getting whole result set into java while it is efficient to handle in DB
- customize CHECK_IN/UPDATE services to update cached distincts (that means no grouping on custom queries)
May be there was some sort of discussion or blog note?
Thanks in advance.If you do not declare "SearchEngineName" as part of the request, whatever value is defined in config.cfg is used. This behavior is by design.
Setting it in your request allows you to override the system setting in order to use another search engine, provided that the rest of the underlying parts are in place for the engine you are trying to use. For example, if your system setting is "DATABASE.METADATA", setting your individual request to "ORACLETEXTSEARCH" will probably fail, since the Oracle full text indexes would not exist. But if you are doing just metadata searching based on a couple of columns, and don't need the full text part for the request, it's a good way to craft a very specific search. Combined with a couple of database indexes on the columns in the where clause, it's also a good performer.
I do "SearchEngineName=DATABASE" usually in conjunction with the parameter "SearchQueryFormat=Native" so I can create some database specific queries in native SQL (and thus avoiding the need to figure out the exact internet or universal syntax.) Your mileage may vary. -
Count number of distinct values for a column for all tables that contains that column
Imagine I have one Column called cdperson. With the query below I know which Tables have column cdperson
select
t.[name]fromsys.schemassinnerjoin
sys.tables
tons.schema_id=t.schema_idinnerjoin
sys.columnscont.object_id=c.object_idinnerjoin
sys.types
donc.user_type_id=d.user_type_idwherec.name ='cdperson'
now I want to know for each table, how many distinct values of cdperson I have and I want the result ordered by the table that has more distinct values (descending)
Table1
cdperson select distinct(cdperson) = 10
cdadress
quant
Table2 with
cdaddress (no column cdperson in this table)
quant
Table3
cdperson select distinct(cdperson) = 100
value
Table 4
cdperson select distinct(cdperson) = 18
sum
I want this result ordered by number of distinct cdperson
table3 100
table4 18
table 10
Thks for your answersI had to add schema name to the above script to make it work in AdventureWorks:
CREATE TABLE #temp(TableName sysname , CNT BIGINT)
DECLARE @QRY NVARCHAR(MAX);
SET @qry=(SELECT
N'INSERT INTO #TEMP SELECT '''+schema_name(t.schema_id)+'.'+T.[name] +''' AS TableName, COUNT (DISTINCT ProductID) DistCount FROM '+
schema_name(t.schema_id)+'.'+t.[name] +';'
FROM sys.schemas s INNER JOIN sys.tables t ON s.schema_id=t.SCHEMA_ID
INNER JOIN sys.columns c ON t.object_id=c.object_id INNER JOIN sys.types d ON c.user_type_id=d.user_type_id
WHERE c.name ='ProductID'
FOR XML PATH(''))
EXEC(@QRY)
SELECT * FROM #temp ORDER BY TableName
DROP TABLE #temp
Production.Product 504
Production.ProductCostHistory 293
Production.ProductDocument 31
Production.ProductInventory 432
Production.ProductListPriceHistory 293
Production.ProductProductPhoto 504
Production.ProductReview 3
Production.TransactionHistory 441
Production.TransactionHistoryArchive 497
Production.WorkOrder 238
Production.WorkOrderRouting 149
Purchasing.ProductVendor 211
Purchasing.PurchaseOrderDetail 211
Sales.SalesOrderDetail 266
Sales.ShoppingCartItem 3
Sales.SpecialOfferProduct 295
Kalman Toth Database & OLAP Architect
SQL Server 2014 Database Design
New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014 -
Selecting last value for a given date
I've read some of the other threads on the this tope, but can't find a resolution.
My query is supposed to get the last values for the given two days (start date and end date) and I return the difference between the two values. The query as it is only works for days where there is an entry for 12:00 pm. On some days, it will therefore return nothing. But I'm not sure how to get it to choose the last value for the given day and still remain a fast query.
Here is a sample of the query with dates that return a result.
SELECT max_query.sgnl_id as sgnl, max_query.max_val - min_query.min_val result_val
FROM
(SELECT t1.sgnl_id, t2.smpl_dte, t1.pv_id,
MAX(t2.integ_since_val) AS max_val
FROM diag.blm_acct t2, diag.pv_sgnl_id_assc t1
WHERE t2.smpl_dte = TO_DATE ('11/15/2008 12:00:00 PM', 'MM-DD-YYYY HH:MI:SS AM')
AND t1.pv_id = t2.pv_id
AND t2.pv_id IN
(SELECT pv_id
FROM diag.pv_sgnl_id_assc
WHERE sgnl_id IN
(SELECT sgnl_id
FROM diag.series_sgnl_rec_asgn
WHERE series_id = 'Series5'
GROUP BY t1.sgnl_id, t2.smpl_dte, t1.pv_id
) max_query ,
(SELECT pv_id,
MAX(integ_since_val) AS min_val
FROM diag.blm_acct
WHERE smpl_dte = TO_DATE ('11/10/2008 12:00:00 PM', 'MM-DD-YYYY HH:MI:SS AM')
AND pv_id IN
(SELECT pv_id
FROM diag.pv_sgnl_id_assc
WHERE sgnl_id IN
(SELECT sgnl_id
FROM diag.series_sgnl_rec_asgn
WHERE series_id = 'Series5'
GROUP BY pv_id
) min_query WHERE max_query.pv_id = min_query.pv_id
ORDER BY max_query.sgnl_idThe data set in the table is quite large, but the above query returns only 49 results (one for each signal in 'Series5').
I tried the following statement by itself to get the last value, but it takes quite a long time to execute (increased the overall query time from 1 sec to 400+ sec when used in the query above):
SELECT DISTINCT trunc(smpl_dte) as the_day,
first_value(integ_since_val) over (partition by trunc(smpl_dte) order by smpl_dte desc) as last_val_per_day
FROM diag.blm_acct WHERE pv_id = 3 and trunc(smpl_dte) = to_date('05/18/2008', 'MM-DD-YYYY ')Any thoughts?Well here is an example of the output I'm trying to generate:
SGNL RESULT_VAL
CCL_Diag:BLM00:Slow60PulsesTotalLoss 52.843439255
CCL_Diag:BLM101:Slow60PulsesTotalLoss 55.7883452511etc...
Here is the table structure:
describe diag.blm_acct;
Name Null Type
BLM_ACCT_ID NOT NULL NUMBER(12)
PV_ID NOT NULL NUMBER(38)
SMPL_DTE NOT NULL DATE
INTEG_OVER_VAL BINARY_DOUBLE()
INTEG_SINCE_VAL BINARY_DOUBLE()
INTEG_TYPE_ID NUMBER(3)
describe diag.PV_SGNL_ID_ASSC
Name Null Type
PV_ID NOT NULL NUMBER(38)
SGNL_ID NOT NULL VARCHAR2(75)
describe diag.SERIES_SGNL_REC_ASGN
Name Null Type
SERIES_ID NOT NULL VARCHAR2(50)
SGNL_ID NOT NULL VARCHAR2(75)
DISP_ORD_NBR NUMBER The main problem I'm having is how to replace this line of code:
WHERE t2.smpl_dte = TO_DATE ('11/15/2008 12:00:00 PM', 'MM-DD-YYYY HH:MI:SS AM')with something that will get the last value (integ_since_val) in the diag.blm_acct table for the 11/15 date.
Edited by: Solerous on Feb 18, 2009 11:32 AM - I figured out how to output the table data -
Using Select List value for building report
I have an interactive report form. I have a "After Header" (LOAD) process that run sql commands that will populate a table with the data that the report needs for a given week.
I have a Select List item that is run as a "Before Header" that gets a list of dates from a table. The dates only contain the first day of the week for the past two years. It is called "WEEK_OF" table and the column is called "WEEK_OF_DATE".
The default value for the Select List is the first day of the current week. And then all of the first day of the week from the WEEK_OF table.
I would like the LOAD process to use the value in the Select List. So at start up I would like the List to show the current week and report to begin with data from the current week.
So I have tried to use the variable :WEEK_OF_DATE (Item name) as the beginning date for the report. However :WEEK_OF_DATE is null.
Also, after I have the report displayed, I would like to select a new date from the list and have the report automatically refresh with that new data.
Any Ideas what I am doing wrong?Hi Lyle,
When setting a default value for a select list that is to be used to filter a report, I have found it best to do that using a computation, conditional on the item being NULL and running Before Header. If other computations rely on this value, then it should have the lowest sequence number to ensure that the value is available for those.
Andy -
Select mutilple values for variableprompt
Hi,
In obiee 11.1.1
I would like to know if i am creating a variable prompt with sql results and selecting user input as Choice List,and checking the Enable user to select mutilple values checkbox and also Require User input checkbox,Will i be able to select mutilple values or not because now i am not able to do so?I am able to select only single value
Thanks
Edited by: Akshara on Jan 17, 2011 7:25 PMHi akshara,
Is this what you are looking for http://www.shivabizint.wordpress.com/.../all-choices-for-edit-box-control-in-obiee- dashboard-prompt/
Sorry,if the link doesnt work search in google with the topic all-choices-for-edit-box-control-in-obiee- dashboard-prompt cz i dont have access.
Hope it answers your question.
Cheers,
KK -
Discoverer Report: Select all values for a Page Item
Hi Guys
I have created a Disco Report which has one Page Item.
It populates all columns based on values I select for Page Item that is perfectly fine.
How do I Display column values for all possible values of Page Item?
Is thera ny way I can have Option to select All possible values for Page Item?
Cheers
VijayHi Vijay
Just to confirm what Rod has said, this capability to manage ALL in Page Items was introduced as part of 10.1.2 and has been maintained into 10.1.2.3 and 11g. It will not be back ported to previous releases.
Best wishes
Michael
Maybe you are looking for
-
Get date-time from .lvm
With Labview I've created a .lvm file with 6 colums of data. The .lvm also contains a x value (+1 for each row) so i'm saving 1 row of data every second. If I plot the data in Diadem the X-axis shows up as relative time, but I want to see the absolut
-
Can I install OS X Server on my Macbook Pro ?
Q1) Can I install OS X Server on my Macbook Pro (mid 2010) and use it as a server in my small office network ? Q2) If i have OS X Server, can some of the client machines be windows Xp / 7 ? Will it work well ?
-
CRVS2010 Beta - Missing parameter values
I want to export my report to pdf file and I want to set some parameters in report in runtime. But when I try to do it I have exception "Missing parameter values". Productversion: Visual Studio 2010 + Crystal Report 2008 + service pack v3. I read tha
-
Should I Scale in Premiere or Use Cameras in AE?
I'm using Dynamic Link to cut talking head videos in Premiere and bring into AE- my question: is it ok to use different cameras in AE instead of scaling in Premiere? I just want to make sure that when I do a closeup shot or zoom in AE, it doesn't los
-
I was trying to update my iphone software then there was an error and it started to remove stuff out of my phone. it said it would restore since my last backup which was last year. I dont care about my apps or music. Are my photos and contacts remove