Incorrect query result with Top N condition and two structures
Hi,
I have created a query on a FI-GL infocube with the characteristic 0BUS_AREA in rows and two structures in columns. The first structure has two items / selections (each item is a selection of several GL accounts). The second structure has two items (the first one contains the key figure 0BALANCE for the current period and the second item is a formula that calculates the absolute value of the first item. The first item is hidden). The (simplified) result looks like this (sorry, not very pretty!):
Business Area Clients Clients fae
Business Area1 10 15
Business Area2 20 7
Business Area 3 15 8
Overall result 45 30
I then added one condition using the Top N operator. The condition is defined for all the elements of the structures. When I execute the query, I sometimes obtained an incorrect number of Top N records selected. The problem seems to occur when N is greater than the number of available Business Areas for an element of the structure.
For example, if N = 8 and data only exists for 5 Business Areas for the structure element Clients, I may end up with 10 Business Areas for the second structure element Clients fae when I only expect 9 (i.e. the top 8 Clients fae + 1 of the Top 8 Clients for which there is no data under Clients fae).
Has anybody encoutered that kind of problem ?
Many thanks.
François.
Pascal,this is a known behavior with conditions.When you apply condition it just hide the extra rows and it does not impact the result row.So your result row actually shows the value irrespective of the condition you apply.
Now with the help of local functions like calculate result as summation you can show the correct sum after applying the condition but when you try to use that result in some calculation then it takes the original value thereby discarding the calculated value.
Same is happening in your case as well.Its taking the original value i.e 350 and not the calculated sum after condition i.e 270.
Hope this helps.
Regards,
AL
Similar Messages
-
Incorrect query results with conformResultsInUnitOfWork
Hi,
has anybody experienced this:
Take two classes User and Group
Group has a 1:n Mapping to User (attribute users)
User has a 1:1 Mapping to User (attribute partner).
Following query returns too many objects
User user1 = someUserObject;
ReadAllQuery readAllQuery = new ReadAllQuery(Group.class);
Expression e = builder.anyOf("users").get("partner").equal(user1);
readAllQuery.setSelectionCriteria(e);
readAllQuery.conformResultsInUnitOfWork();
Vector vector = (Vector) unitOfWork.executeQuery(readAllQuery);
It returns
- the correct Group object as determined from the sql query +
- any other objects of the same class that are fully instantiated (users is instantiated and for each user, partner is instantiated), even if they don't conform to the expression.
The same query works properly ;
- without conformResults
- or if the other objects are not fully instantiatedHi,
we need an workaround badly and the support is moving at exactly the rate I feared it would.
So I thought, since we only hit this bug with existing objects and we use conformResultsInUnitOfWork because we want to find the newly created objects, is there a way to get
- the SQL Query results
+ any new objects that conform to the query
We still might get new objects that don't conform to the query (this is the bug) but I'll worry about that later if it happens.
My first attempt at a solution looks like this:
1. turn off conformResults
2. manually add all new objects that conform to the query
I had to guess a little for 2, since I don't know what exactly toplink does to select the "conform" objects.
private static List findConformNewObjects(UnitOfWork unitOfWork, ReadAllQuery query) {
List result = new ArrayList();
Class resultClass = query.getReferenceClass();
Expression selectionCriteria = query.getSelectionCriteria();
Enumeration enumeration;
IdentityHashtable newObjectsCloneToOriginal = unitOfWork.getNewObjectsCloneToOriginal();
if (newObjectsCloneToOriginal != null && newObjectsCloneToOriginal.size() > 0)
enumeration = newObjectsCloneToOriginal.keys();
while (enumeration.hasMoreElements())
Object o = enumeration.nextElement();
if (resultClass.isInstance(o))
if (selectionCriteria != null && selectionCriteria.doesConform(o, unitOfWork, null, query.getInMemoryQueryIndirectionPolicy()))
result.add(o);
return result;
Does this look OK to you? Is there a better way to do it?
Ana -
Copy BW query results with formatting
When copying a query's results to another workbook, the formatting (namely coloring) changes. Is there any way to copy the query results to a new workbook and keep the exact same formatting as in original query?
One way to do this would be to copy the worksheet with the results to the other workbook, as follows:
Edit --> Move or copy sheet... --> change "To book:" to the 2nd workbook --> check "Create a copy" option --> OK
After doing that, you can cut & paste from the copied worksheet to other worksheets in the workbook, if necessary, and the formatting will be maintained.
Hope this helps...
Bob -
Script for Save Options- Save Query Results with document
Hi,
Is there any javascript for Save query results with document in save options? If so where can i find that?
Thanks
Kalaihi guys,
I found the answer.The following example shows you how to save the results with the query
section named “SalesQuery”.
ActiveDocument.Sections["SalesQuery"].SaveResults=true -
Query with Top N Condition (Result Row)
Hi,
I made a query with an active top n condition. The query has 2 Keyfigures and 1 formula
Gross-sales acutal | Gross-sales previous year | Previous Year %
So that to result line is correct, I had to say "Calculate result as summation" for the keyfigures
gross sales actual and gross sales previous year. That works.
I have the problem with my formula. the formular for previous year % is defined as follows:
gross sales actual %A gross sales previous year
Example Top 3 Customer
gross sales actual gross sales prev. year prev. year %
Cust 1 100 80 125 %
Cust 2 90 45 200 %
Cust 3 80 60 133 %
Result 270 185 142.8 % ( 350 * 100 / 245 )
The result of 142 % is the correct result without the condition top 3. with the top 3 condition
the result should be 270 * 100 / 185 = 145.9 %
Additional customer without top 3 condition
Cust 4 50 40 125 %
Cust 5 30 20 150 %
It shows the correct result for each single line. The result in the result row is wrong. it is calculated
without taking the active condition. the formular calculates
with the total gross sales actual and the total of gross sales prev. year.
is there any solution the achieve the correct % in the result row?
thanks for your help.
PascalPascal,this is a known behavior with conditions.When you apply condition it just hide the extra rows and it does not impact the result row.So your result row actually shows the value irrespective of the condition you apply.
Now with the help of local functions like calculate result as summation you can show the correct sum after applying the condition but when you try to use that result in some calculation then it takes the original value thereby discarding the calculated value.
Same is happening in your case as well.Its taking the original value i.e 350 and not the calculated sum after condition i.e 270.
Hope this helps.
Regards,
AL -
Numbering query results with a line number in SQL*Plus
Doesn't it stand to reason that in SQL*Plus there would be a way to number each query results sequentially with line numbers starting at 1 to n -- something option like from a SET command? I'm not talking about linesize.
There's a column rownum the engine adds into the result sets, just add it to the select list. Can use it to limit the result set (with some limitations) i.e.:
select rownum, ... from ... where rownum <= 100
Can't use ">=", that condition will never be met but a subset could be used:
select * from ( select rownum as linenr, tab1.* from ... ) where linenr between 10 and 20 -
Top 10 Condition and Zero Suppression
I have a query that has a zero suppression turned on, so that rows/columns that have no values are suppressed.
I have added a condition to the query such that only the top 10 are displayed.
The problem is that the condition appears to be applied after the zero suppression. The result is that when the top 10 are displayed, it is displaying blank columns, as there may be values in a column, but none of them fit into the top 10 criteria.
Does anyone know how I can suppress the zero columns/rows when the top 10 condition is active as well.
Thanks in advance for any assistance.
Regards
RichardHi Anil,
Thanks for the response.
Unfortunately the column(s) that are to be hidden will change depending on the data, so this will not work.
ie. if you consider a query that has products on the rows, customer across the top, and there is a top 10 condition on the net sales of the product, so I will always have 10 rows of products, but the number of columns will vary, depending on how many customers have bought that product.
Thanks again for your suggestion.
Regards
Rich -
Query result caching on oracle 9 and 10 vs indexing
I am trying to improve performance on oracle 9i and 10g.
We use some queries that take up to 30 minutes to execute.
I heard that there are some products to cache query results.
Would this have any advantage over using indexes or materialized views?
Does anyone know any products that I can use to cache the results of this queries on disk?
Personally I think that by using the query result caching I would reduce the cpu time needed to process the query.
Is this true?Your message post pushes all the wrong buttons starting with the fact that 9i and 10g are marketing labels not version numbers.
You don't tune queries by spending money and throwing resources at them. You tune them by identifying the problem queries, running explain plans, visualizing their output using DBMS_XPLAN, and addressing the root cause.
If you want help post full version numbers, the SQL statements, and the DBMS_XPLAN outputs. -
Need to hide rows in the Query results with blank values
Hi All,
We have a requirement like this for Stock Report, we need to display both movements and balance in that report. We display the movement data directly from the Standard cube with input as Fiscal period/year. When we do like this, we are not able to get the opening balance as fiscal period was in char restrictions pane.
We have created a dummy keyfigure restricted to Fiscal period ( so that the global filter is not applied and get the inventory data irrespective of fiscal period input ). We have created 3 variables of processing type customer exit and acheived calculating opening balance, current movement and closing balance.
If FP input is 009.2010 to 010.2010, it will get whatever Qty moved before 009.2010 ( 001.1990 - 009.2010 in exit ) as opening balance and closing balance ( 001.1990 - 010.2010 ) and the Qty KF restricted with another exit varibale ( 009.2010 to 010.2010 ).
Hope everyone understood the scenario and issue here is, though I give the input 009.2010 - 010.2010 , I get the rows displayed for different periods ( this is because I am retreiving data for all the fiscal periods but restricting it based on input ). How to restrict/hide these rows.
Your inputs and suggestions are valued.
Thanks,
Chandra.Hi,
Try creating a query level field which would populate as "X" (with the IF condition ) if the record falls in the period which you have given for input variable (009.2010 - 010.2010). Then place a query level filter for this field where only records with value "1" for this field is displayed.
Hope this helps.
Happy to help further.
Regards
Venky -
Query parameters with the same name and different values
According to HTTP, multiple query or post parameters with the
same name and different values are permitted. They are transfered
over the wire in the following format -
name1=val1&name1=val2&name1=val3
The problem is that I can't see anyway of assigning multiple
parameters with the same name and different values to the request
object of mx.rpc.http.HTTPService. I have tried using the
flash.utils.Dictionary object as it does strict key comparison but
that doesn't work too. I have tried setting an array of values to a
property of the request object but that sends the request to the
server in the following format -
name1=val1,val2,val3
The java servlet engines throw exceptions when they see this.
Any help would be greatly appreciated.If you're not on 8.1.4 move there. 8.1.3 had limitations in the wsrp
release.
wrote:
I have an html select box that contains several values, and multiple
selection is enabled. When my code runs as a remote portlet, the
following is showing up in the soap monitor when I select multiple
values and submit the form:
<urn:interactionParams>
<urn:portletStateChange>cloneBeforeWrite</urn:portletStateChange>
<urn:interactionState>_action=addEmployeesToGroup</urn:interactionState>
<urn:formParameters
name="P62005wlw-select_key:{actionForm.selectedEmployees}OldValue">
<urn:value>true</urn:value>
</urn:formParameters>
<urn:formParameters
name="P62005wlw-select_key:{actionForm.selectedEmployees}">
<urn:value>beatest1</urn:value>
</urn:formParameters>
In this case, I selected beatest1 and beatest2, but only beatest1 comes
through to the remote portlet. Is this a known bug, and, if so, is
there a patch or workaround available?
Thanks in advance,
Andy -
I am querying for distinct data from one table but I need
only the most recent data. I am currently using the query included
below, but if there are two entries for any of the paddocks and the
species are different in them I will get both entries returned. I
need it to return just the most recent of those two entries. How do
I do this??
If this were my data I would only want it to return: 1, cool
and 2, warm
Paddock Species Date
1 Warm 1/1/05
1 Cool 1/7/05
2 1/5/05
2 Warm 1/7/05
<cfquery name="getpaddocks" datasource="dairy">
SELECT this.paddock, this.species
FROM
(select distinct paddock, species
FROM dairy.dbo.paddockdata
WHERE FarmId='#session.data.farmid#'
and year(datadate)= year(current_timestamp)
)as this
ORDER BY RIGHT('00000' + paddock, 3)
</cfquery>something like this might work
select p.paddock thepaddock, p.species thespecies
from paddockdata p join
select paddock tpaddock, species tspecies, max(datadate)
maxdate
from paddockdata
where FarmId='#session.data.farmid#'
and year(datadate)= year(current_timestamp)
group by paddock, species
) temp on paddock = tpaddock and species = tspecies and
datadate = maxdate
where FarmId='#session.data.farmid#'
and year(datadate)= year(current_timestamp) -
Displaying results with a decimal place of two. Forcing decimal place.
Hi there,
Im writing a simple calculation device.
You input one digit and press one of two buttons to multiply it by a certain number and then the result is displayed. The result is displyed hiding the result of the button you didn't press and visa versa.
I am having a problem displaying the result with a constant two decimal place.
I am using strings and thus don't know how to do this.
Here is my code:
import flash.events.MouseEvent;
//restrict the input textfield to only numbers
txtinput.restrict = "0-9";
//restrict the input textfield to only two characters
txtinput.maxChars = 6;
// event listeners
btnW.addEventListener(MouseEvent.CLICK, WHandler);
btnC.addEventListener(MouseEvent.CLICK, CHandler);
btnW.addEventListener(MouseEvent.CLICK, hideC);
btnC.addEventListener(MouseEvent.CLICK, hideW);
//functions
function WHandler (e:MouseEvent):void
//white calculation
var answerW:Number = Number(txtinput.text) * Number(0.90);
txtWResult.text = answerW.toString();
function CHandler (e:MouseEvent):void
//colour calculation
var answerC:Number = Number(txtinput.text) * Number(0.99);
txtCResult.text = answerC.toString();
function hideC (e:MouseEvent):void
//Hide colour result
txtCResult.visible = false;
txtWResult.visible = true;
function hideW (e:MouseEvent):void
//Hide white result
txtWResult.visible = false;
txtCResult.visible = true;
After having a look online I have found these two resources:
http://helpx.adobe.com/flash/kb/rounding-specific-decimal-places-flash.html
and
http://stackoverflow.com/questions/11469321/decimals-to-one-decimal-place-in-as3
But I am confused when combining these techniques with strings.
Any help would be greatly appreciated,
Thanks in advance
Mr BUse the toFixed() method of the Number class instead of the toString() method. The result of it is a String with the number of decimal places you specify.
var answerW:Number = Number(txtinput.text) * Number(0.90);
txtWResult.text = answerW.toFixed(2);
var answerC:Number = Number(txtinput.text) * Number(0.99);
txtCResult.text = answerC.toFixed(2); -
iPhone WiFi issue. I enter a password, click join, and get a message back that it is an incorrect password. I have several computers and other iPhones connected using the same password. Any ideas?
Hey there Gordo456,
It sounds like you are not able to join your Wi-Fi network with the correct password on 1 out of many devices. I recommend the troubleshooting from the article named:
iOS: Troubleshooting Wi-Fi networks and connections
http://support.apple.com/kb/TS1398
Restart your iOS device.
Update your device to the latest version of software.
Update your Wi-Fi router to the latest firmware2. For AirPort Base Stations, install updates using the AirPort Utility.
If that troubleshooting does not resolve the issue, I would next try these steps from further down the article:
Unable to connect to a Wi-Fi network
Verify that you're attempting to connect to your desired Wi-Fi network.
Make sure you're entering your Wi-Fi password correctly. Passwords may be case sensitive and may contain numbers or special characters.
Reset network settings by tapping Settings > General > Reset > Reset Network Settings. Note: This will reset all network settings including:
previously connected Wi-Fi networks and passwords
recently used Bluetooth accessories
VPN and APN settings.
Thank you for using Apple Support Communities.
Regards,
Sterling -
5770 with 27" Apple LED and two 20" Apple Cinema Displays w/Mac Pro
As stated, I just bought a brand new Mac Pro 8-core (2010 ID 5,1) with a 5770 card and I'm trying to hook up a new 27" Apple LED and two 20" cinema displays. One of the 20" monitors is using the MDP adapter into the 5770 and the 27" is directly connected to the other MDP port. When I try to hook up the other 20" to the DVI port on the 5770 I get nothing. The screen is black and the it is not recognized as being connected. I'm using the standard DVI connector that came with the 20" direct into the 5770. To make sure it isn't a monitor problem, I switched out the 20" displays and both work using the MDP adapter but neither work plugging directly into the DVI port on the 5770. I believe the 20" monitors use DVI-D. (Is that correct?) So what's the scoop on getting blank screens when plugging into the DVI port on the 5770? Thanks for any help.
"• the 27" is directly connected to the other MDP port.
• One of the 20" monitors is using the MDP adapter into the 5770.
• When I try to hook up the other 20" to the DVI port on the 5770 I get nothing.
Note: If you are using an Apple Mini DisplayPort to DVI adapter, only two displays are supported across the three ports.
If you are connecting three displays, any DVI displays must be connected to either the Dual-Link DVI port or must use an Apple Mini DisplayPort to Dual-Link Adapter.
You MUST use All "Active" or "Powered" Mini DisplayPort connector such as the Apple Dual Link, or you can only use two displays -
My quantity is showing with a decimal point and two spaces
When people are entering a quantity of 1 it is showing as 1.00. It is confusing my users because they think this is a price. How can I get rid of the decimal point and two spaces?
Hi,
I am not able to reproduce this problem with a number field. Are you using this field as a payment-quantity field?. If so, please check that the Quantity in your payment setting is linked the the right field.
We can do a quick test: create a new form from scratch, add one textfield, then on the field property panel select Type=number.
Select Test tab and click on the Test Web Form button
Enter a number and commit --> check if you get the decimal point and the spaces.
If you still have problem with this, let me know
Thanks,
Lucia
Maybe you are looking for
-
Aperture to iPhone sync not working correctly
When sync'ing photo's from Aperture to my iPhone 6+ , I have filters that work perfectly in Aperture, but I still end up with photo's I shouldn't have (should have been filtered out) sent to my iPhone. is this a known bug? How do I fix this? Thanks,
-
How to get Preview to be Safari's default PDF viewer
I mistakenly downloaded Adobe Acrobat Reader, after being advised by a state tax website. I wish I had first tested my existing configuration because Safari/Preview had always worked just fine for viewing PDF (with the Feds!), but I didn't. Adobe A
-
I just installed a Belkin router to my computer so I can connect to my apartment building's internet. EVerything is working fine, the internet works. But I'm now getting this message and I'm not sure what to do? Help?
-
Problems installing Photosmart A646 HELP!
I cannot get either my laptop or desk top to install the printer. My laptop thinks it's a mass storage device. I talked at length this evening to an HP tech. Her conclusion was that the USB port was faulty on the printerm so I took it back and exc
-
Optimizing images / lightroom - photoshop workflow.
Is it better to save your files in photoshop cs5 (save for the web and other devices) or Lightroom 4.3. through the export function? Which method would result in better optimized images. Is it possible to initially edit images in Lightroom 4.3; them