Help:Using Order by for a date column fetching wrong results
Hi all,
In my table I am having a date column which is having values
13/06/2007 09:24:00
31/05/2007 10:30:00
I am selecting this column with some other columns using order by at the end by giving the date column.
But I am getting rows in reverse order like above. I am using to_char(start_time,'dd/mm/yyyy hh:24mi:ss') in the select.
If I give to_date(start_time) in the order by the values are fetching correclty.But I was not allowed to use to_char in the select statement.
Kindly suggest me where it went wrong.
Thanks in advance.
Hi , Thanks for the update. Actually that column was an Oracle DATE type. Earlier I gave simply that column name alone in the order by clause. That is getting falied only if the 2 entries falls in different months. Otherwise that is perfect.
So I gave to_date in the order by. But now I am facing a problem in the selecing that column.
Similar Messages
-
Data Federator XI 3.0 using DB2 VARCHAR FOR BIT DATA Column?
We have a column in a DB2 database that is defined as VARCHAR(16) FOR
BIT DATA.
We are using the suggested IBM JDBC driver, db2jcc.jar, against a DB2
OS/390 8.1.5 version database.
The Datasource column displays a data type of NULL, indicating the DF
does not understand or cannot handle this IBM data type.
We have two issues.
First, target tables are not able to return any columns, regardless if
we exclude columns defined as NULL as mentioned above. We see the
'Wait' animation for a very long time when we use the 'Target table
test tool' option. Selecting to display the count only, returns zero.
We are able to fetch and view non-NULL column data when using the
'Query tool' under the Datasource pane.
I also get the same result when using the 'My Query Tool' in Server
Administrator; a selection agains the sources returns data while
selecting from a target table returns no data. Also, a 'select
count(*)' returns zero.
The second issue is in mapping a relationship between two DB2 tables
where the join is between two columns of the above mentioned type
(NULL).
The error we get back when we use "Show Errors" is "The types
'NULL' (in 'S1.PLANNEDGOALID') and 'NULL' (in 'S2.PLANNDEDGOALID') are
not compatible.". When reviewing the relationship, a dashed red line
appears instead of a solid grey line between the two tables in the
"Table relationships and pre-filers" section of our mapping pane.
The following query returns an error via the Server Administrator
Query Tool; "Types 'NULL' and 'NULL' are not compatible for operator
'=' (Error code : 10248)".
select count(*)
from
(select s1.CASEID, s2.PLANNEDGOALID, s2.NAME, s2.PLANNEDGRPSTTYCD
from "/DF_CMS_ODS/sources/CMFSREPT/CMSPROD.PLANNEDGOAL" AS s1
,"/DF_CMS_ODS/sources/CMFSREPT/CMSPROD.PLANNEDGOAL" s2
where s1.PLANNEDGOALID = s2.PLANNEDGOALID)
Here are the properties settings in the Resource Connector Settings
for jdbc.db2.zSeries we are using.
capabilities: isjdbc=true;orderBy=false
driverLocation: drivers/db2jcc_license_cisuz.jar;drivers/db2jcc.jar
jdbcClass: com.ibm.db2.jcc.DB2Driver
sourceType: db2
supportsCatalog: no
urlTemplate: jdbc:db2://<hostname>[:<port>]/<databasename>
Here are the Connection parameters as defined for the datasource in DF
Designer.
Defined resource: jdbc.db2.zSeries
Jdbc connection URL: jdbc:db2://DB2D03:50000/CMFSREPT
Authentication: Use a specific database logon for all Data Federator
users.
User Name: x
Password: hidden
Login domain: -- Choose a defined login domain --
Supports Schema: checked
Schema: is empty
Prefix table names with schema name: checked
Supports catalog: unchecked
Prefix table names with the database name: unchecked
Table types: TABLE and VIEW
So, the following is the two questions we require answers for...
Is this a limitation of Data Federator?
Is there a work around short of changing the datatype in the database.Hi Darren,
The VARCHAR() FOR BIT DATA is a binary data type and Data Federator does not support binaries. But if in your case, it makes sense to map this column to a VARCHAR data type you can configure the DB2 connector to view this column as a VARCHAR.
Your column can be mapped explicitly to a data type of your choice using a property: castColumnType.
This property can be set updating the resource you selected when you registered you DB2 data source.
If the resource is "jdbc.db2", then:
1. Launch Data Federator Administrator
2. Click on "Administration" tab
3. Click on "Connector Settings"
4. Select the right resource: "jdbc.db2"
5. Click "Add a property"
6. Select "castColumnType"
7. Set its value to: VARCHAR() FOR BIT DATA=VARCHAR
8. Click on Ok
You should see this column as a VARCHAR.
Regards,
Mokrane
PS: For the target table issue, we have forwarded your mail to the Data Federator Designer team. -
How to write a query with group by and order by for a date column
I have a query:
select count(*), to_char(s.pdate,'Mon-yyyy') as month from sTable s
group by to_char(s.pdate,'Mon-yyyy')
order by to_date(s.pdate,'Mon-yyyy')
However, I got an error: not a GROUP By expression.
If i just run: select count(*), to_char(s.pdate,'Mon-yyyy') as month from sTable s
group by to_char(s.pdate,'Mon-yyyy')
it is work fine.
How to solve the problem.
Thanks,
JenJen,
You can use this code
with sTable as (select to_date('01/01/2009', 'dd/mm/yyyy') pdate, 1 code from dual union all
select to_date('02/02/2009', 'dd/mm/yyyy') a, 2 code from dual union all
select to_date('01/03/2009', 'dd/mm/yyyy') d, 3 code from dual union all
select to_date('05/04/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/05/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/06/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/07/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/08/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/09/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/10/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/11/2009', 'dd/mm/yyyy') g, 4 code from dual union all
select to_date('05/12/2009', 'dd/mm/yyyy') h, 5 code from dual)
select cnt, to_char(to_date(mnt||'01', 'yyyymmdd'), 'Mon-yyyy')
from (select count(*) cnt, to_char(s.pdate,'yyyymm') as mnt
from sTable s
group by to_char(s.pdate,'yyyymm')
order by to_char(s.pdate,'yyyymm')
CNT MONTH
1 Jan-2009
1 Feb-2009
1 Mar-2009
1 Apr-2009
1 May-2009
1 Jun-2009
1 Jul-2009
1 Aug-2009
1 Sep-2009
1 Oct-2009
1 Nov-2009
1 Dec-2009
12 rows selectedyour problem was that you are using a expresión in the order by (to_date...) that is distinct to the query results (to_char...).
Regards,
Mike -
Applying order by for the data comming from the formula column
Dear Friends,
I am having a report in which some of the columns in which data is comming from the formula columns,but i need the data in asc order.
How can i do it.
Please advice.I am having a report in which some of the columns in
which data is coming from the formula columns,but i
need the data in asc order.Lets say you have this query:
select empno, sal, comm from emp
And you have empno, sal, comm and a formula column 'f_percentage' in one group. Add one dummy column in the query, like this:
select 'temp' temp, empno, sal, comm from emp
Move this 'temp' column into the second group (drag and drop outside the first group). You don't have to create repeating frame/or need to show this 'temp' column on the report.
Now if you use break order on formula column, that should work. Make sure you have break order on other columns also. Arrange items (change order) in data model as you needed. Run your report before and after this change and make sure you have same number of rows before and after this change.
(from reports builder's help)
"Break Order has no effect on columns that belong to the lowest group of a particular query. Break Order only affects columns in groups that are above the lowest child group of a query" -
Create a formula variable using replacement path for current date
Hi All,
I created a formula variable using replacement path for current date.
But when i used this variable am getting an error message saying .
" This Variable cannot be used in this query".
Could you please let me know the reason?
Thanks,
ZehraHi All,
Thanks for all your help...
I just found a solution via the below link
in Bex Formula variabel, Current calander day(sap exit) missing.
Here he is trying to use the existing formula variable.
My doubt here is, Even i could not find this varaible in BEX formula variable, But could see this in BI Content path as mentioned in the above link. DO i have to transport this varaible , or i simply can activate it in production?
I just could find this in BI Content but not in MetaData Repository.
Thanks,
Zehra -
Error in creating RSDS using transfer rules for master data datasources
Hi ,
when i am creating the transfermations(RSDS) using transfer rules for master data datasources while i want to migrate datasource.it is giving the error message saying that INITIAL ERROR OCCURED DURING GENERATION OF THE TRANSFERMATION.AND in the taskbar it is giving the message LOG IS BEING LOADED.
MY QUESTION IS HOW CAN WE SEE THE LOG? AND
PLEASE GIVE ME THE STEPS TO MIGRATE MASTER DATASOURCES.
THANKS IN ADVANCE .Hi Ankit,
Yoy have to load data to the cube.For that you need update rules.
Steps to load data to the cube
1.Replicate the datasource.
2.Assign Infosource
3.Create transfer rules
4.Maintain the update rules to the cube.
5.Right click on the datasource and schedule an infopackage for it.
Execute the Infopackage and pull the data to the cube.
Hope this helps
Regards
Karthik -
Problem while using BCP utility for witing data in file
hi all,
I have a batch file in which I am using bcp command for reading data from MS SQL and writing it in delimiter file. Now there are some exceptions in MS SQL that while writing into file whenever it encounters new line character it switches to next line while writing and starts writing the rest of the data on next.
Could you help me in getting rid of this problem. I wanted to replace the new line character with space.
Thanks and regards
NitinHi Dilip,
Before going for any other table,
As Kalnr is only one of the primary keys of table KEKO, You can try creating secondary index on KEKO, which might help in improving your report performance.
Also, you can add more conditions in where clause if possible, which will also help in improving performance.
Thansk,
Archana -
Error : Concatenated values used in documents for master data
Hi Experts,
I am trying to add one characteristics as compounding characteristics to my master data info object.
previously 'Document property' option was checked for the infoobject. so i unchecked it, as it was not allowing me to add the compounding characterisitcs.
After doing the changes, when I am trying to save, its throwing error as 'Concatenated values used in documents for master data'.
Can anyone please help me with what exactly does it mean and what would be the solution to remove this error.
Thanks,
Neelima
Edited by: Potnuru Neelima on Mar 1, 2011 8:39 AM
Edited by: Potnuru Neelima on Mar 1, 2011 8:40 AM
Edited by: Potnuru Neelima on Mar 1, 2011 8:41 AMHi All,
Just found the soultion...wanted to share this....
Actually one document was created on one of my opportunity values, which was not simply visible from edit menu -> documents.
Go to RSA1 -> documents -> master data -> and then give ur info object name -> will get all the documents maintained corresponding to it. Need to delete them.
Then compounding characteristic can be added to our info object.
Regards,
Neelima -
Concatenated values used in documents for master data-Urgent
Hi,
while trying to activate a master data object, it is not activating and this message appears
"Concatenated values used in documents for master data"
Please help me in this regard.Hi,
this forum is about the SAP BusinessObjects BI Solution Architecture. I would suggest you post your questions into the SAP BW forum.
regards
Ingo Hilgefort -
I have a production mobile Flex app that uses RemoteObject calls for all data access, and it's working well, except for a new remote call I just added that only fails when running with a release build. The same call works fine when running on the device (iPhone) using debug build. When running with a release build, the result handler is never called (nor is the fault handler called). Viewing the BlazeDS logs in debug mode, the call is received and send back with data. I've narrowed it down to what seems to be a data size issue.
I have targeted one specific data call that returns in the String value a string length of 44kb, which fails in the release build (result or fault handler never called), but the result handler is called as expected in debug build. When I do not populate the String value (in server side Java code) on the object (just set it empty string), the result handler is then called, and the object is returned (release build).
The custom object being returned in the call is a very a simple object, with getters/setters for simple types boolean, int, String, and one org.23c.dom.Document type. This same object type is used on other other RemoteObject calls (different data) and works fine (release and debug builds). I originally was returning as a Document, but, just to make sure this wasn't the problem, changed the value to be returned to a String, just to rule out XML/Dom issues in serialization.
I don't understand 1) why the release build vs. debug build behavior is different for a RemoteObject call, 2) why the calls work in debug build when sending over a somewhat large (but, not unreasonable) amount of data in a String object, but not in release build.
I have't tried to find out exactly where the failure point in size is, but, not sure that's even relevant, since 44kb isn't an unreasonable size to expect.
By turning on the Debug mode in BlazeDS, I can see the object and it's attributes being serialized and everything looks good there. The calls are received and processed appropriately in BlazeDS for both debug and release build testing.
Anyone have an idea on other things to try to debug/resolve this?
Platform testing is BlazeDS 4, Flashbuilder 4.7, Websphere 8 server, iPhone (iOS 7.1.2). Tried using multiple Flex SDK's 4.12 to the latest 4.13, with no change in behavior.
Thanks!After a week's worth of debugging, I found the issue.
The Java type returned from the call was defined as ArrayList. Changing it to List resolved the problem.
I'm not sure why ArrayList isn't a valid return type, I've been looking at the Adobe docs, and still can't see why this isn't valid. And, why it works in Debug mode and not in Release build is even stranger. Maybe someone can shed some light on the logic here to me. -
After upgrade from 4.6c to ECC6.0 F4 Help is not coming for few date fields
Hi Friends
Just now we have completed upgrade project from 4.6c to ECC6.0.
After upgrade F4 help is not working for some date fields.
For example its working in MB11,Its not working in va01,vf01 like that.
In abap side we checked ...not able to find any issues in coding level, because its a standard SAP code.
So if any solution is there to correct this issue.Kindly help me to resolve this asap.
Thanks
Gowrishankar
Edited by: gowrishankar p on Nov 17, 2009 7:25 AMHi
Please refer to the SAP note 1278056 and 1278115 - PDS Display: F4-characteristic values are not selectable. Hope this will resolve your issue.
Regards,
JB -
How to Flip the Sign using Calculation script for historical data
I am currently using Essbase 9.3.1. Its required to flip sign for a specific set of accounts for that i am currently using UDA's to flip the sign.
But now i need to flip the sign for the historical data too. Is there any possible way to flip the sign using calculation scripts for historical data. Kindly let me know your suggestions.
Many thanks in Advance...
Edited by: [email protected] on Jul 30, 2009 9:37 PM
Edited by: [email protected] on Jul 30, 2009 10:58 PM
Edited by: [email protected] on Jul 30, 2009 11:01 PMOf course there is. This is the kind of calc script that only gets run once, so make usre you test it well before doing it on production and make a backup of production before doing it.
It would be something like
Fix(time frame, accounts to be flipped, level zero other dimensions)
actual = actual * -1;
EndFix
Cal dim dimensions
Note, I chose actual, but you could do it for any dimension that has a single or only a couple of members. What ever dimension you choose to do the calculation on, it can't be included in the fix statement -
Windows Desktop Search 4.0 How do I Format the Date Column in the Results?
Is there a way to modify the date column in the Results pane of Windows Desktop Search 4.0?
It's running on a Windows 2003 Enterprise server.
I have users that need to modify files that arrived today and yesterday after 5:00 PM. The date column only displays the time on files with today's date. Is there some registry setting I can tweak to get this column to always show Date and Time?
Cordially,
RNHi,
For the Windows Desktop Search, i think you may ask in:
http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/home?forum=windowsdesktopsearchhelp
Regards.
Vivian Wang -
I receiving my gmails with 15+ minutes delay. this is because no option for "push" data, only "fetch" for gmail account. How can fix that?
Sign up for Google's paid Apps for Business service, you can then set things up using Exchange & you'll get push using Gmail. Otherwise, you can't get push using Gmail.
-
Stock confiramtion at sales order level for future date- Availability Check
Hi all
Here is the scenario
This setting is available in the system:
Stock is available
Sales order created with Requested delivery date in future-> not confirmed
Sales order created with Requested del date today -> confirmed
The requirement :
how and where to change this setting in IMG so that also orders with Requested Delivery Date in future are confirmed if stock is available.
As this is urgent request to respond quickly.
Regards
DevenderHello Devender,
You can achieve the mentioned scenario by configuring ATP. You can do ATP with RLT or ATP without RLT.
In ATP with RLT, system will check and confirm the quantities from existing stock only and if quantities are insufficient then the system will consider inline POs or manufacturing time to confirm remaining quantitites.
Else you will be getting schedule lines for only items in stock and remaining will be unconfirmed as ATP without RLT will be activated i.e., system will check and confirm the quantities from existing stock only.
Types of Availability Check in Sales and Distribution
Processing
There are three types of availability check:
_ Check on the basis of the ATP quantities
_ Check against product allocation
_ Check against planning
The following SD-specific control features need to be maintained in Customizing:
_ Checking group
The checking group controls whether the system is to create individual or collective
requirements in sales and shipping processing. In addition, a material block for the
availability check with transfer of requirements can be set here. The checking group can
also be used to deactivate the availability check. This option was created especially for
the assembly order so that when the bill of material is exploded in the assembly order,
the individual components, if necessary, can be classified as non-critical parts as far as
procurement is concerned.
The checking group specifies in combination with the checking rule the scope of the
availability check. It is proposed in the material master record on the basis of the material
type and the plant, and copied into the sales and distribution documents.
_ Checking Rule
You use the checking rule to control the scope of the availability check for each
transaction in sales and distribution. You also specify whether the check should be
carried out including or excluding replenishment lead time. The individual checking rules
define by transaction, which stock and inward and outward movement of goods should
be taken into account for the availability check.
_ Schedule line category
You can control with the schedule line category whether an availability check and
transfer of requirements should be carried out in the sales documents. The possible
settings for this at schedule line level are dependent on the settings in the requirements
class which is determined from the requirements type of the material.
_ Delivery item category
The delivery item category can be used to control whether an availability check takes
place in deliveries.
Requirements type
The various requirements are identified by their requirements type. The requirements
type refers to the requirements class and its control features.
_ Requirements Class
The requirements class contains all control features for planning such as relevance for
planning, requirements planning strategy and requirements consumption strategy. In
addition, it is specified at a global level whether an availability check is to take place for
the material in the sales and distribution documents on the basis of the ATP quantity
(ATP = available to promise) and whether requirements are to be passed on. A finer
degree of control can be obtained for sales documents using the schedule line category.
Replenishment lead time is only included in the check performed on the basis of the
ATP quantity.
Prerequisites
An availability check can only be carried out if the following prerequisites have been fulfilled:
_ The control elements described above for the availability check must be maintained in
Customizing for Sales and the relevant assignments made to the sales transactions
_ The availability check must be switched on at requirements class level and - for the
availability check in the sales documents - at schedule line category level
A requirements type must exist by which the requirements class can be found
_ A plant must be defined. It can either be proposed from the customer or material master
record or can be entered manually in the document.
_ A checking group must be defined in the material master record on the Sales/plant data
screen in the Availability check field
Configuring entries of the Availability Check
IMGSDBasic fncsAvailability check and TORAvailability checkAvailability check with ATP logic or against planningDefine checking groups
You can use SAP std checking groups of 01 for summarized reqts or 02 for daily reqts or u can create ur own.
The columns total sales and total deliveries are selection options whereby u can configure a checking rule to sum up reqts to post to MRP either individually or by day or week.
Column 5, Block qty; set this block if u want several users to be able to process the material simultaneously in different transactions without blocking each other. The No Check indicator is used when u want a material to not be relevant for an ATP check.
Defining a material block for other users. The Block checkbox is an indicator that enables u to block the particular material from being checked for availability if it is already being checked at the same time by another user.
Defining the default value for checking groups. However should no entry exist for the checking group in the material master record, one can set a default value per material type and plant.
Controlling the availability check. In this section, u tell the system what stock on hand and what inward and outward movements of stock it must take into account when performing the availability check. These settings are based on the checking group that is assigned to the material master record and the checking rule that is predefined and assigned to the sd transaction. The carry out control for the availability check must be maintained for both the sales order and delivery.
Reward points if helpful.
Regards,
Priyanka
Maybe you are looking for
-
The movie I want is 127 hours. I search it and it doesn't show up but sometime before I saw the option to buy it!
-
Installing a windows 7 (64 bit) printer driver to existing windows xp network
Dear-Users......... i have connected 5 computers through a switch and ( hp laserjet 2014) printer is directly connected to one of them and shared on the network. 3 computers running on windows xp and one i added last time it was windows 7 (32 bit) i
-
Trouble printing to PDF. Purchased and loaded Acrobat X1 Standard on Windows 7 computer. Message on trying to print to a PDF in micorsoft word and other programs is: 'Unable to find adobe PDF resource files'. When i look in appdata\roaming\adobe\adob
-
Selecting dynamically changing file
Hi everyone I'm creating a script that will copy the currently selected track from itunes to the desktop and import into iMovie. The following is what I have thus far: -- check if itunes is open tell application "Finder" if (get name of every process
-
AD login issues - takes forever!
Is there An alternative workaround for the login issue(takes forever to logon to an AD environment)? Do I have to create an Open Directory master in a subordinate role to the AD server. If so any documentation for that? Thanks, Indiana