Query to get possible values for each segment
Hi Gurus,
Give the flex value set id, what is the query to get all possible values for each segment (just like what is shown in the accounting flex window)?
Thank you,
Beibei
Hi Beibei,
The table FND_FLEX_VALUES_VL can give you details of values available in the Value set i.e. 1 segment at a time.
If you are looking for a concatenated view of Accounting Flexfield values, that would be available in GL_CODE_COMBINATIONS table.
Regards,
Ivruksha
Similar Messages
-
Query to get a value for each day in a month
Hi All,
I'm needing a query (preferably without a loop or function) that can get a number representing each day of a given month.
For example for the month of February, the result would be 1,2,3,....28
Surely this can be done?
Thanks!SQL> with a as (
2 select trunc(sysdate,'Month') mon from dual)
3 SELECT mon + LEVEL - 1 AS dates
4 FROM a
5 CONNECT BY LEVEL <= ADD_MONTHS (mon, 1) - mon;
DATES
01-FEB-11
02-FEB-11
03-FEB-11
04-FEB-11
05-FEB-11
06-FEB-11
07-FEB-11
08-FEB-11
09-FEB-11
10-FEB-11
11-FEB-11
DATES
12-FEB-11
13-FEB-11
14-FEB-11
15-FEB-11
16-FEB-11
17-FEB-11
18-FEB-11
19-FEB-11
20-FEB-11
21-FEB-11
22-FEB-11
DATES
23-FEB-11
24-FEB-11
25-FEB-11
26-FEB-11
27-FEB-11
28-FEB-11
28 rows selected.or if u want it in one query,Then
SQL> SELECT trunc(sysdate,'Month') + LEVEL - 1 AS dates
2 FROM dual
3 CONNECT BY LEVEL <= ADD_MONTHS (trunc(sysdate,'Month'), 1) - trunc(sysdate,'Month');
DATES
01-FEB-11
02-FEB-11
03-FEB-11
04-FEB-11
05-FEB-11
06-FEB-11
07-FEB-11
08-FEB-11
09-FEB-11
10-FEB-11
11-FEB-11
DATES
12-FEB-11
13-FEB-11
14-FEB-11
15-FEB-11
16-FEB-11
17-FEB-11
18-FEB-11
19-FEB-11
20-FEB-11
21-FEB-11
22-FEB-11
DATES
23-FEB-11
24-FEB-11
25-FEB-11
26-FEB-11
27-FEB-11
28-FEB-11
28 rows selected.
SQL> Regards
Umesh -
TSQL Get Previous values for each group by
Dear Friends,
I have a problem with my TSQL statment.
I need to get previous value for each day and specific unit. Everything goes fine if I have always 2 unit in each day. But if same day has just one unit or less, I cannot have the previous value in the current record.
The Output is this one:
SK_DAY SK_UNIT
VALUE VALUE_PREVIUS_DAY
20131112 2
30.00 NULL
20131112 3
34.00 NULL
20131113 2
40.00 30.00
20131113 3
45.00 34.00
20131114 2
50.00 40.00
I dont have the second record for 2013-11-14, because in this date I just have value for unit 2.
The final output should include the record:
20131114 3
0 45.00
The Statment I have is:
SELECT MAIN.SK_DAY, MAIN.SK_UNIT, SUM(MAIN.VALUE) AS VALUE
SELECT SUM(VND1.VALUE) AS VALUE
FROM FCT_TEST VND1
WHERE CONVERT(DATE,CONVERT(VARCHAR(10),VND1.SK_DAY))>=DATEADD(dd,-1,CONVERT(DATE,CONVERT(VARCHAR(10),MAIN.SK_DAY)))
AND CONVERT(DATE,CONVERT(VARCHAR(10),VND1.SK_DAY))<CONVERT(DATE,CONVERT(VARCHAR(10),MAIN.SK_DAY))
AND VND1.SK_UNIT=MAIN.SK_UNIT
) AS VALUE_PREVIUS_DAY
FROM FCT_TEST MAIN
GROUP BY SK_DAY, MAIN.SK_UNIT
SQL CREATE SCRIPT:
CREATE TABLE [dbo].[FCT_TEST](
[SK_DAY] [int] NOT NULL,
[SK_UNIT] [int] NOT NULL,
[VALUE] [decimal](18, 2) NULL,
CONSTRAINT [PK_FCT_TEST] PRIMARY KEY CLUSTERED
[SK_DAY] ASC,
[SK_UNIT] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Thank you!!!
PPSQLThank you Kalman,
But my problem is not with date! Fortunately I have dates for all days.
The problem is for dimension tables like UNITS that I dont have values for all days, and when I try to get the previous value for previous day and each unit I dont have records.
20131112
2
30.00
NULL
20131112
3
34.00
NULL
20131113
2
40.00
30.00
20131113
3
45.00
34.00
20131114
2
50.00
40.00
20131114
3
0
45.00 [I NEED THIS RECORD AS IS]
Could you help me??
Thank you!! -
Get bit value for each pixel.
i use the 16bit image so i need to get the bit value for each pixel. hope someone knows it can help me. thanks.
Get the BufferedImage Object and do a getData() on it . This returns a Raster object. The Raster Object has methods for retrieving the pixel information.
hope this helps. -
Issue with Report to get Position value for each Class ID.
Hello Experts,
m working on a report where I want Position values as on date.
for an entered date report should give position value(Amount for transaction) for each class Id.
I m trying using the exit variable but could not reach the output.
For date I created an exit variable which shoud return the latest position for each class Id.
Now this exit variable is "ready for Input" . when I debug my code it takes i_step =3 and i_vanm= " " after i_step = 1 and i_vnam = "<variablename>"
how do I go about to get the solution.
Guide me to come up with desired output.
Thanks in Adv.
Bhavna.Hello Experts,
m working on a report where I want Position values as on date.
for an entered date report should give position value(Amount for transaction) for each class Id.
I m trying using the exit variable but could not reach the output.
For date I created an exit variable which shoud return the latest position for each class Id.
Now this exit variable is "ready for Input" . when I debug my code it takes i_step =3 and i_vanm= " " after i_step = 1 and i_vnam = "<variablename>"
how do I go about to get the solution.
Guide me to come up with desired output.
Thanks in Adv.
Bhavna. -
Sql query - Selecting last recorded values for each date in specified period
Hello,
Can someone please help me with my problem.
I'm trying to get last recorded balance for each day for specific box (1 or 2) in specified period of days from ms access database using ADOTool.
I'm trying to get that information with SQL query but so far unsuccessfully...
My table looks like this:
Table name: TestTable
Date Time Location Box Balance
20.10.2014. 06:00:00 1 1 345
20.10.2014. 12:00:00 1 1 7356
20.10.2014. 18:45:00 1 1 5678
20.10.2014. 23:54:00 1 1 9845
20.10.2014. 06:00:02 1 2 35
20.10.2014. 12:00:04 1 2 756
20.10.2014. 18:45:06 1 2 578
20.10.2014. 23:54:10 1 2 845
21.10.2014. 06:00:00 1 1 34
21.10.2014. 12:05:03 1 1 5789
21.10.2014. 15:00:34 1 1 1237
21.10.2014. 06:00:00 1 2 374
21.10.2014. 12:05:03 1 2 54789
21.10.2014. 15:00:34 1 2 13237
22.10.2014. 06:00:00 1 1 8562
22.10.2014. 10:00:00 1 1 1234
22.10.2014. 17:03:45 1 1 3415
22.10.2014. 22:00:00 1 1 6742
22.10.2014. 06:00:05 1 2 562
22.10.2014. 10:00:16 1 2 123
22.10.2014. 17:03:50 1 2 415
22.10.2014. 22:00:10 1 2 642
23.10.2014. 06:00:00 1 1 9876
23.10.2014. 09:13:00 1 1 223
23.10.2014. 13:50:17 1 1 7768
23.10.2014. 19:47:40 1 1 3456
23.10.2014. 21:30:00 1 1 789
23.10.2014. 23:57:12 1 1 25
23.10.2014. 06:00:07 1 2 976
23.10.2014. 09:13:45 1 2 223
23.10.2014. 13:50:40 1 2 78
23.10.2014. 19:47:55 1 2 346
23.10.2014. 21:30:03 1 2 89
23.10.2014. 23:57:18 1 2 25
24.10.2014. 06:00:55 1 1 346
24.10.2014. 12:30:22 1 1 8329
24.10.2014. 23:50:19 1 1 2225
24.10.2014. 06:01:00 1 2 3546
24.10.2014. 12:30:26 1 2 89
24.10.2014. 23:51:10 1 2 25
Let's say the period is 21.10.2014. - 23.10.2014. and I want to get last recorded balance for box 1. for each day. The result should look like this:
Date Time Location Box Balance
21.10.2014. 15:00:34 1 1 1237
22.10.2014. 22:00:00 1 1 6742
23.10.2014. 23:57:12 1 1 25
So far I've managed to write a query that gives me balance for ONLY ONE date (date with highest time in whole table), but I need balance for EVERY date in specific period.
My incorrect code (didn't manage to implement "BETWEEN" for dates...):
SELECT TestTable.[Date], TestTable.[Time], TestTable.[Location], TestTable.[Box], TestTable.[Balance]
FROM TestTable
WHERE Time=(SELECT MAX(Time)
FROM TestTable
WHERE Location=1 AND Box=1 );
Tnx!
Solved!
Go to Solution.For loop
following query keep day (here 24 in below query) Variable from ( 1 to 28-29/30/31 as per month)
SELECT TOP 1 TestTable.[Date], TestTable.[Time], TestTable.[Location], TestTable.[Box], TestTable.[Balance]
FROM Test Table.
WHERE Time=(SELECT MAX(Time) FROM TestTable WHERE Location=1 AND Box=1 )
AND DATE = "2014-10-24";
PBP (CLAD)
Labview 6.1 - 2014
KUDOS ARE WELCOMED.
If your problem get solved then mark as solution. -
XML DB: is it possible to get a row for each element in a container element?
I have an XML document containing a container element (collection). If I query, using an XPath expression, the contained elements I get a row for each container element with the contained element concatenated. Is it possible to get a row for each contained element?
I run this simple query:
select extract(xmltype('<colors><color>Red</color><color>Green</color></colors>')
, '/colors/color/text()').getstringval() from dual
And get this result:
EXTRACT(XMLTYPE('<COLORS><COLOR>RED</COLOR><COLOR>GREEN</COLOR></COLORS>'),'/COL
RedGreen
1 row selected.
What I would like to have is:
Red
Green
2 rows selected.
Wishful thinking or possible? Many thanks!Sure. This is where our XMLSequence() function comes in. It allows you to treat the top-level nodes in a nodeset as if they were rows in a table when combined with the TABLE() operator. Here's an example.
First, to make the SQL look a little cleaner, I like to define a function like this:
create or replace function testdoc return xmltype as
begin
return xmltype('<colors><color>Red</color><color>Green</color></colors>');
end;.
To break out the nodeset of <color> elements as a table, we use the following query:
select value(list_of_color_elements).extract('*/text()').getStringVal() as color
from TABLE( XMLSequence( extract(testdoc(),'/colors/color'))) list_of_color_elements.
Or, using the new-in-9.2 extractValue() operator so we don't have to remember the text() part:
select extractValue( value(list_of_color_elements), '.') as color
from TABLE( XMLSequence( extract( testdoc() ,'/colors/color'))) list_of_color_elements.
Here the TABLE(XMLSequence(...)) combo produces a table of XMLType, with one XMLType object in each row of the table.
In general, if the XMLType instance were coming from an XMLType table xmltab the query would look like this:
select extractValue( value(colors), '.') as color
from xmltab x, /* Important that this table comes earlier in the FROM clause! */
TABLE( XMLSequence( extract( value(x),'/colors/color'))) colors.
And if the XMLType were instead in a column of XMLType named doc in a table xmltab, then we would have the syntax:
select extractValue( value(colors), '.') as color
from xmltab x, /* Important that this table comes earlier in the FROM clause! */
TABLE( XMLSequence( extract( x.doc ,'/colors/color'))) colorsOnce you get the hang of it, you'll see that the combination of TABLE(XMLSequence()) to "shred" XML nodes into rows, and XMLAgg() to aggregate fragments of XML across multiple rows back into a single document, is quite powerful. -
How to Get Missing Dates for Each Support Ticket In My Query?
Hello -
I'm really baffled as to how to get missing dates for each support ticket in my query. I did a search for this and found several CTE's however they only provide ways to find missing dates in a date table rather than missing dates for another column
in a table. Let me explain a bit further here -
I have a query which has a list of support tickets for the month of January. Each support ticket is supposed to be updated daily by a support rep, however that isn't happening so the business wants to know for each ticket which dates have NOT been
updated. So, for example, I might have support ticket 44BS which was updated on 2014-01-01, 2014-01-05, 2014-01-07. Each time the ticket is updated a new row is inserted into the table. I need a query which will return the missing dates per
each support ticket.
I should also add that I DO NOT have any sort of admin nor write permissions to the database...none at all. My team has tried and they won't give 'em. So proposing a function or storable solution will not work. I'm stuck with doing everything
in a query.
I'll try and provide some sample data as an example -
CREATE TABLE #Tickets
TicketNo VARCHAR(4)
,DateUpdated DATE
INSERT INTO #Tickets VALUES ('44BS', '2014-01-01')
INSERT INTO #Tickets VALUES ('44BS', '2014-01-05')
INSERT INTO #Tickets VALUES ('44BS', '2014-01-07')
INSERT INTO #Tickets VALUES ('32VT', '2014-01-03')
INSERT INTO #Tickets VALUES ('32VT', '2014-01-09')
INSERT INTO #Tickets VALUES ('32VT', '2014-01-11')
So for ticket 44BS, I need to return the missing dates between January 1st and January 5th, again between January 5th and January 7th. A set-based solution would be best.
I'm sure this is easier than i'm making it. However, after playing around for a couple of hours my head hurts and I need sleep. If anyone can help, you'd be a job-saver :)
Thanks!!CREATE TABLE #Tickets (
TicketNo VARCHAR(4)
,DateUpdated DATETIME
GO
INSERT INTO #Tickets
VALUES (
'44BS'
,'2014-01-01'
INSERT INTO #Tickets
VALUES (
'44BS'
,'2014-01-05'
INSERT INTO #Tickets
VALUES (
'44BS'
,'2014-01-07'
INSERT INTO #Tickets
VALUES (
'32VT'
,'2014-01-03'
INSERT INTO #Tickets
VALUES (
'32VT'
,'2014-01-09'
INSERT INTO #Tickets
VALUES (
'32VT'
,'2014-01-11'
GO
GO
SELECT *
FROM #Tickets
GO
GO
CREATE TABLE #tempDist (
NRow INT
,TicketNo VARCHAR(4)
,MinDate DATETIME
,MaxDate DATETIME
GO
CREATE TABLE #tempUnUserdDate (
TicketNo VARCHAR(4)
,MissDate DATETIME
GO
INSERT INTO #tempDist
SELECT Row_Number() OVER (
ORDER BY TicketNo
) AS NROw
,TicketNo
,Min(DateUpdated) AS MinDate
,MAx(DateUpdated) AS MaxDate
FROM #Tickets
GROUP BY TicketNo
SELECT *
FROM #tempDist
GO
-- Get the number of rows in the looping table
DECLARE @RowCount INT
SET @RowCount = (
SELECT COUNT(TicketNo)
FROM #tempDist
-- Declare an iterator
DECLARE @I INT
-- Initialize the iterator
SET @I = 1
-- Loop through the rows of a table @myTable
WHILE (@I <= @RowCount)
BEGIN
-- Declare variables to hold the data which we get after looping each record
DECLARE @MyDate DATETIME
DECLARE @TicketNo VARCHAR(50)
,@MinDate DATETIME
,@MaxDate DATETIME
-- Get the data from table and set to variables
SELECT @TicketNo = TicketNo
,@MinDate = MinDate
,@MaxDate = MaxDate
FROM #tempDist
WHERE NRow = @I
SET @MyDate = @MinDate
WHILE @MaxDate > @MyDate
BEGIN
IF NOT EXISTS (
SELECT *
FROM #Tickets
WHERE TicketNo = @TicketNo
AND DateUpdated = @MyDate
BEGIN
INSERT INTO #tempUnUserdDate
VALUES (
@TicketNo
,@MyDate
END
SET @MyDate = dateadd(d, 1, @MyDate)
END
SET @I = @I + 1
END
GO
SELECT *
FROM #tempUnUserdDate
GO
GO
DROP TABLE #tickets
GO
DROP TABLE #tempDist
GO
DROP TABLE #tempUnUserdDate
Thanks,
Shridhar J Joshi
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'> -
How to get Privacy Policy value for each userprofile in sharepoint 2010?
In userprofile application, we have defined Privacy Policy of mobilephone feild as optional, so every user has option to choose visibility scope of this property to "Everyone/My Manager/my colegues/Only Me" .
Now I am trying to get mobilephone value and their selected visibility option for each user.
I am able to get mobilephone value but I could not get "what each user has chosen as their visibility scope"?Hi,
According to your post, my understanding is that you want to get Privacy Policy value for each userprofile in sharepoint 2010.
You need to use RunWithElevatedPrivileges method to impersonate user.
To get the get mobilephone policy, you can use user["CellPhone "].Privacy.
For more information, you can refer to:
c# - Getting property privacy with Sharepoint 2010
How to Programmatically Impersonate Users in SharePoint
Managing Sharepoint 2010 Profiles Programmatically
Thanks,
Linda Li
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Linda Li
TechNet Community Support -
Find out and get the bit value for each pixel in image
i use 16bit image. the image is 200x200 pixels. i need to know what is
the bit value for each pixel. example(0111111011111101).
where i can see the bit value output. if somebody got the example surce code please send it to me.coz i need the bit value to find out how many RGB color that use in the image. thanks for ur help.How many logins do you have???
-
I'm trying to get the count for each row to total count for each month
Something like this
Hardware | Jan
Monitors | 5
Processors | 137
Printers | 57
etc........
How can I write a query for this. I can get the Hardware column but don't know how to get the next column.If you can provide more data like sample input DML statements it would have been wonderful..
Assuming is , you need a pivot. Here is an article on basic Pivot..
http://sqlsaga.com/sql-server/how-to-use-pivot-to-transform-rows-into-columns-in-sql-server/
something like this may be..
DECLARE @Input TABLE
Hardware VARCHAR(20),
[Date] VARCHAR(20)
INSERT INTO @Input VALUES('Monitor', '01/01/2014'), ('CPU', '01/01/2014'), ('Monitor', '01/03/2014')
, ('ABC', '01/01/2014'),('Monitor', '02/01/2014')
;WITH CTE AS
SELECT Hardware, LEFT(DATENAME(M, [Date]),3) AS [MonthName] FROM @Input
SELECT *
FROM
SELECT Hardware, [MonthName], COUNT(Hardware) AS Count FROM CTE GROUP BY Hardware, [MonthName]) a
PIVOT (MAX([Count]) FOR [MonthName] IN ([Jan], [Feb])) pvt
Please mark as answer, if this has helped you solve the issue.
Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles. -
Qry:How to get different price for each price list (variable area) in order
1-How to get different price for each price list (variable area) in order for sale. for the opportunity to display and select multiple prices.
2- I add a location store from a table in line item and I want to see this area in order,.
I 'm created 2 field location(item line and order), 1 table location
I tried this for exemple : select $ [userfieldlocation.OITW]Thanks Suda for your answer,
the Formatted Search for prices is OK, but for the Item locations in warehouse this is not so simple,
I must have several (at least 2) locations for the item in the Warehouse and a track of this location and search possibilities.
read carefully and imagine how (Management warehouse locations)
I added a user table '@Location' who linked to a user field 'U_Location in Item master data --> lnventory data line and an ather user field 'U_Location' in sales order
I met the value of location in the table (list of locations for any warehouse), I select the location of each item while receiving merchandise in the user field of inventory data line (Item M data) and this value appears in the sales order 'U_Location' user field ( only the location value in the default warehouse for this Item)
or
create an user field 'location' in Good receipt PO to fill it while receiving merchandise that appears in the sales order to give possibility to find/select the location of the item at this order and in Item master data
I think we will use all these tables
@LOCATION
PDN1
OITM
OITW
OWHS
RDR1
Juste a another question : where you found this and What is: ' 38.1.0 '
Is it in document (System information):Item=38 Pane=1 ??
Thanks,
Ouchen -
Vendor Open Items for each Segment ?
Hi all,
What is the most effective way to grouped the all Vendor Open Items for each Segment ?
I think i should use tables BSIK and (BSEG or FAGLFLEXA).
Field BSEG-SEGMENT does not always have a value (often is empty), so it is likely to be used FAGLFLEXA-SEGMENT.
Thanks in advance
Serena.
-
Hi,
I need to get the details for each user hit.
Apparently, this table has the IMPRESSIONS column which returns the total number of hitcounts and VISITS which counts the number of unique user who accesses the portal. What I am trying to look for is to get all the details per hitcount. I need to find out how many time a specific user accessed a specific page or iview.
I also used the table WCR_USERPAGEUSAGE, which I get the information of the users counted in the VISITS column in the first table.
I could not get the specific user per hit.
Please enlighten me if this is possible and how to do this?
Thanks!Hi Catherine,
Why not use the portal activity report iView?
In the portal activity report iView the 3rd option allows you to choose a page for example and see
the user who accessed it and how many times.
Thanks and BR,
Saar -
Creation of a Query to show the values for the current month and the last 12 months data.
Dear All,
Good day!
I have to create a Query with the below requirement.
I have to create a Query to show the values for the current month and the last 12 months data.
Can you please guide me how to achieve this ??
thank you,
Regards,
HemaHema
explain the exact problem..? as you mentioned you want to create query to show values for current month and last 12 months.. so I think you want to show values for 12 months from current data.. you can achive this by multiple way..
you can have selection screen and field with date .. and restrict based on system current date and 12 months before or you can handle this at your target.. .. I mean there are multiple ways to restrict data by date range..
for some more hints..
http://www.forumtopics.com/busobj/viewtopic.php?t=34393&sid=7fba465d0463bf7ff5ec46c128754ed6
http://businessintelligence.ittoolbox.com/groups/technical-functional/cognos8-l/how-to-display-last-12-months-in-report-based-on-todays-date-3231850
http://scn.sap.com/thread/3217381
search on SDN you will get many other ways..
Thanks,
Bhupesh
Maybe you are looking for
-
Branch wise sales analysis report
Hi Client wants to see sales analysis report branch wise. How to do so? Thanks
-
Excel Charts do not get displayed correctly (colour) !urgent!
Hi, believe me: I spent days in research to fix my problem but could not find a solution yet... I use a lot of Excel Web Parts on my SharePoint Site. Basically to display charts or tables. Everything worked fine for months but out of a sudden some of
-
Hi there, I need to setup EMail Enabled lists in SharePoint 2010 site. Where do I need to run the SMTP server? On APP server or on Exchange Server? Or somewhere else? Thank you so much.
-
Hi, I have a hexadecimal file , which I have in an internal table. The contents of the Iternal table are from a PDF file on my local machine, by calling: CALL FUNCTION 'GUI_UPLOAD' What I want to do is save this information in a database table, so
-
Sell my BluRays and buy all my movies in iTunes?
Hello all, So I've got an odd question in which i'm looking for some opinions. I am a HUGE movie junkie and easily have about roughly 200 Blu Ray movies. I love watching movies all the time obviously but I've recently moved into an apartment where th