Need Help to Densify and Rank Data
Hi Pros!
I've been researching, but can still use some help here with a telecom application. Say I have the following records in table cost:
Acct,Code, Rate
1, 001, .1
1, 0012, .1
2, 001, .2
2, 0012, .2
2, 00123, .2
2, 001234, .2
And I want the following results:
Row, Code, Acct, Rate, Rank,
1, 011, 1, .1, 1
2, 011, 2, .2, 2
3, 0012, 1, .1, 1
4, 0012, 2, .2, 2
5, 00123, 1, .1, 1
6, 00123, 2, .2, 2
7, 001234, 1, .1, 1
8, 001234, 2, .2, 2
I use the following query for the ranking:
SELECT code, acct, rate, drank
FROM (SELECT code, acct_id, DENSE_RANK() OVER(PARTITION BY code ORDER BY rate ASC) drank
FROM costs)
Because the data is not uniform (or dense), I would only get the following results:
Row Code Acct Rate Rank
1, 011, 1, .1, 1
2, 011, 2, .2, 2
3, 0012, 1, .1, 1
4, 0012, 2, .2, 2
5, 00123, 2, .2, 1
6, 001234, 2, .2, 1
So what I'm looking for is to densify the data so that for code 00123 and 001234
rates in account 1 would be duplicated for the higher codes as follows:
Acct Code Rate
1, 001, .1
1, 0012, .1
1, 00123, .1
1, 001234, .1
So if accounts without rates for the more specific codes are replicated out to match accounts with the most specific codes, I would have correct ranking. This is for routing purposes, so if a shorter code exists within a longer code and has a cheaper rate, then I would want to have a match there. Cost table can have 10 m rows or more.
Any help would be greatly appreciated
Thanks all.
You may use partitioned outer join.
Completion of data series by analytical function
Similar Messages
-
Help with writing and retrieving data from a table field with type "LCHR"
Hi Experts,
I need help with writing and reading data from a database table field which has a type of "LCHR". I have given an example of the original code but don't know what to change it to in order to fix it and still read in the original data that's stored in the LCHR field.
Basically we have two Function modules, one that saves list data to a database table and one that reads in this data. Both Function modules have an identicle table which has an array of fields from type INT4, CHAR, and type P. The INT4 field is the first one.
Incidentally this worked in the 4.7 non-unicode system but is now dumping in the new ECC6 Unicode system.
Thanks in advance,
C
SAVING THE LIST DATA TO DB
DATA: L_WA(800).
LOOP AT T_TAB into L_WA.
ZDBTAB-DATALEN = STRLEN( L_WA ).
MOVE: L_WA to ZDBTAB-RAWDATA.
ZDBTAB-LINENUM = SY-TABIX.
INSERT ZDBTAB.
READING THE DATA FROM DB
DATA: BEGIN OF T_DATA,
SEQNR type ZDBTAB-LINENUM,
DATA type ZDBTAB-RAWDATA,
END OF T_TAB.
Select the data.
SELECT linenum rawdata from ZDBTAB into table T_DATA
WHERE repid = w_repname
AND rundate = w_rundate
ORDER BY linenum.
Populate calling Internal Table.
LOOP AT T-DATA.
APPEND T_DATA to T_TAB.
ENDLOOP.Hi Anuj,
The unicode flag is active.
When I run our report and then to try and save the list data a dump is happening at the following point
LOOP AT T_TAB into L_WA.
As I say, T_TAB consists of different fields and field types whereas L_WA is CHAR 800. The dump mentions UC_OBJECTS_NOT_CONVERTIBLE
When I try to load a saved list the dump is happening at the following point
APPEND T_DATA-RAWDATA to T_TAB.
T_DATA-RAWDATA is type LCHR and T_TAB consists of different fields and field types.
In both examples the dumps mention UC_OBJECTS_NOT_CONVERTIBLE
Regards
C -
Need help in laoding flat file data, which has \r at the end of a string
Hi There,
Need help in loading flat file data, which has \r at the end of a string.
I have a flat file with three columns. In the data, at the end of second column it has \r. So because of this the control is going to the beginning of next line. And the rest of the line is loading into the next line.
Can someone pls help me to remove escape character \r from the data?
thanks,
ragHave you looked into the sed linux command? here are some details:
When working with txt files or with the shell in general it is sometimes necessary to replace certain chars in existing files. In that cases sed can come in handy:
1 sed -i 's/foo/bar/g' FILENAME
The -i option makes sure that the changes are saved in the new file – in case you are not sure that sed will work as you expect it you should use it without the option but provide an output filename. The s is for search, the foo is the pattern you are searching the file for, bar is the replacement string and the g flag makes sure that all hits on each line are replaced, not just the first one.
If you have to replace special characters like a dot or a comma, they have to be entered with a backslash to make clear that you mean the chars, not some control command:
1 sed -i 's/./,/g' *txt
Sed should be available on every standard installation of any distribution. At lesat on Fedora it is even required by core system parts like udev.
If this helps, mark as correct or helpful. -
Need help! Can't validate date overlaps for a tabular column
Hello all,
The validation I created to validate whether new or updates rows does not overlap with any records in the table isn't working.
The columns are StartDt and EndDt
Validation Type: NOT EXISTS
Validation expresion:
select 1
from sample S
WHERE S.STARTDT BETWEEN :STARTDT AND :ENDDT
OR(S.ENDDT BETWEEN :STARTDT AND :ENDDT)
or (S.STARTDT <= :STARTDT and S.ENDDT >= :ENDDT)
or (:STARTDT <= S.STARTDT and :ENDDT >= S.ENDDT)
Error Message:
Times overlap
When Buttons pressed
-Select Button-
The validation works if a new row or updated row overlaps any existing start and end date records but it doesn't work if I update startdate and end date rows that doesn't overlap existing date times
Example:
TABLE DISPLAYS THE FOLLOWING RECORDS
NAME START DATE END DATE
TEST 1/1/2012 12/31/2012
If I update the rows to the following values, I receive an error message (although those values don't overlap any records in the table)
NAME START DATE END DATE
TEST 6/1/2012 10/30/2012
Any ideas? Do I need to change my code?
Click the link to view the answer to this question. Need help! Can't validate date overlaps for a tabular column
Message was edited by: CharlieMackLogic for date range overlap testing only requires two conditions in the WHERE clause:
ORACLE-BASE - Overlapping Date Ranges
WHERE S.STARTDT <= :ENDDT AND S.ENDDT >= :STARTDT -- TRUE for ranges that overlap
It looks a little odd, but, if you scribble out a 'logic table', it makes sense.
Condition
A.start <= B.end
A.end >= B.start
A__A B--B
true
false
A__B=A--B
true
true
A__B==B__A
true
true
B--A==B__A
true
true
B--B A__A
false
true
MK -
I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?
What file format did you export it to?
-
Need help to import and syncronize HCM pagelets with Interaction Hub, how can I do that?
Hi,
I need help to import and synchronize HCM pagelets with Interaction Hub, how can I do that? The default page "Select Remote Content" of the WorkCenter "Unified Navigation WorkCenter" is not working as well, when I run the import/sync button I get the following error message:
Integration Gateway: General Connection Failed (158,10836)
This error is thrown when there is no valid response.
Possible errors include:
Bad gateway URL
Sync Service Timeout set and Service actually timed out.
Java exception thrown - Check Application Server for possible Java exceptionDo you have integration configured between the two systems? It sounds like you don't from the error. Here is a walk-through on setting up Unified Navigation although it assumes you have integration already working. If you haven't done that, it's documented a hundred different places.
http://remotepsadmins.com/2013/03/04/peoplesoft-unified-navigation-with-peoplesoft-applicatations-portal-interaction-hub/ -
I need help in downloading and installing a previously purchased version of Photoshop Elements 12: AD012822594 1057-0247-4177-3303-6451-8067 or 1057-0904-6949-7119-8323-9165
Please do not share serial numbers or Order numbers on Forums . Serial numbers and order numbers are very confidential.
You can only share serial number with Adobe Customer support staff. -
I need help in downloading and installing a previously purchased version of Photoshop Elements 12: <Serial number removed by moderator>
Hi There,
Kindly try: Troubleshoot installation | Photoshop Elements, Premiere Elements | Windows
Thanks,
Atul Saini -
Need Help in installations and connecting displays. Please!
Hello Everyone,
Need Help in installations and connecting displays. Please!
Im planning on installing in a cafe shop : (Store Self improvement)
4 TV's (can be Built in Wi-Fi) Store menus
2 touch screen tablets. To be use as Emenu (digital Menu)
1 60' TV ( Built in Wi-Fi) as Entrainment displays and in store advertising
What do I need to organize my project and make it looks cool and how to manageand controll all of the displays TV.TNSTAAFL
I DO NOT work for Best Buy, Geek Squad and any way affiliated with them. I am a self-employed repairman. I specialize in TV's and desktop computers. I do not take sides. If BB is wrong I will say so. If you are a moron with a false sense of entitlement, then I will tell you. -
I need help from chile and use a language translator to write and not turn my iphone4
I need help from chile and use a language translator to write and not turn my iphone4
http://support.apple.com/kb/TS3281
Not turn on -
Please help me!--rendering makes the images or video blurry (very pixelated) deteriorates the image Adobe Premier Elements 13 need help! .jpg and mpeg images, but I have never "rendered" before since I got APE 13 about 6 weeks ago. I am desperate for assistance!
That's going to be a ridiculous waste of money and energy.
First of all, the current ATI drivers don't support multiple GPUs, so at the moment even a single 4870X2 would be only a 'normal' 4870 (which is quite a speed beast already). GFX drivers evolve rapidly, so things might look different next month, but when it comes to Linux and hardware there's one Golden Rule: stay away from the newest stuff and wait for proper support to get coded.
I also wonder what power supply could possibly cope with the differences between idle and full load; that's way beyond 400W. But then, I'm one of those "quiet&green" types where >100W idle is already a bit much.
I kind of understand that you want to get it done and not worry about hardware for the next 10 years or so, but that's simply not how the hardware world works and never did. At least not for the average consumer. -
I am new to this but need help. Lion and iCloud have never worked on my desk top or MacBook Pro. Slow or Stop! Is there any way to fix the problem?
We need more information. I'm not sure what you mean by both Lion and iCloud have never worked.
-
I need help locating where and how to update Mac OS-X to Mountain Lion.....Thanx....Jay
First update your 10.6 version to 10.6.8 from the software update under the Apple Menu.
This will add direct access to the Mac App store via a new application.
Now launch the App Store from your Applications folder - Its the new icon a letter A formed from a ruler pencil and pen on a blue circle !
Once launched you need to add your iTunes account details or create an account add payment details etc...
Sign in purchase download and follow install processes to upgrade to 10.8 Mountain Lion.
OH and to be safe BEFORE you install backup your current system to an external drive ! -
2008 Mac Pro 10.5.8 shuts down after hours of no use, Set to never shut down. Can be resumed pressing any key but all programs not in startup list need to be restarted and unsaved data lost . New behavior. No system changes.
2008 Mac Pro 10.5.8 shuts down after hours of no use, Set to never shut down. Can be resumed pressing any key but all programs not in startup list need to be restarted and unsaved data lost . New behavior. No system changes.
-
This is a second try to get help. I need help to uninstall and reinstall Photoshop cc 2014
Bridge is not working well, I need to reinstall Photoshop cc 2014 . Someone from Communities was suppose to help me.
Hi John,
I used the chat "Creative chat support" this afternoon at around 14:40
and the person, Karthik M , gave me a link to Technical Support. I
guess he could not help me, but he said he understood the issue. With
the link "Help, Adobe Installation problems", I will follow the
instructions to clean ps cc2014 with CCleaner and reinstall the app.
It looks quite complicated but I will give it a try and hopefully succeed.
You have to understand when reading my previous messages, the issue is
no longer "Retreiving Photoshop CC" but reinstalling Phoshop 2014 to try
to repair Bridge.
Thanks for caring,
Suzanne Lanthier
Le 2014-08-13 15:50, John T Smith a écrit :
>
This is a second try to get help. I need help to uninstall and
reinstall Photoshop cc 2014
created by John T Smith <https://forums.adobe.com/people/JohnTSmith>
in /Adobe Creative Cloud/ - View the full discussion
<https://forums.adobe.com/message/6637788#6637788>
Maybe you are looking for
-
ITunes Store and music keep freezing and closing on me. How can I make this stop?
So I downloaded the 3 versions of Chipstep by Boyinaband, and it's been processing for 5+ hours! Not to mention whenever I go into my music, it stays on my playlists screen and then closes. Same with iTunes, except iTunes actually allows me to do stu
-
Friends, I have Oracle 11g Standard edition and Reports 10g in Win XP. How can I publish my reports in Intranet? Kindly guide me -mathews
-
I haven't managed to install forms 11G as yet, but I was wondering if the same oracle colour schemes were still available and if you could still use the OLAF colours such as: OLAFLight, OLAFDark, OLAFVeryDark,OLAFVeryLight, OLAF1, OLAF2, OLAF3 etc. F
-
C# Calling SAP RFC/Web Service Failure
Hi SAP Experts, I am facing this problem. When an external system is calling my SAP RFC/Web Service, the external system(which is not SAP) is not getting the correct value. But when I test the RFC in SAP GUI It is working correctly. When I test betwe
-
Iphone detected as camera in window 7
hi, need help in my iphone 3g, i have installed the latest itunes and trying to make a backup it seem that my iphone is detected as camera and i can't seem to get the iphone detected in itunes. I am using window 7 home premium. I have try to use my f