Count appearance of different values
Hello and thank you for reading,
I would like to create a query which returns a list of customers with the number of their orders.
My order table looks like this:
CustomerA
CustomerB
CustomerB
CustomerA
CustomerC
CustomerB
I would like to get the following output:
CustomerB 3
CustomerA 2
CustomerC 1
Thanks a lot for all advices
Evgeny
Evgeny wrote:
@user: the problem with that is that I have several hundred customers, so the query would get far too long.
Evgeny,
this part
with t as(
select 'CustomerA' customer from dual
union all
select 'CustomerA' customer from dual
...Is just to produce test data. (Which you should have done, in the first place).
The actual query is just:
select customer, count(*) from t group by customer
order by 2 desc;Where table t, is produced in the WITH clause, above.
Regards
Peter
Similar Messages
-
Count of rows having different values
SQL> select * from med;
CERT REC PRIM RACE
100 10 EN USA
100 11 EN USA
100 12 EN USA
100 13 SP MX
200 14 SP MX
200 15 SP MX
6 rows selected.
SQL> select * from sub;
CERT REC PRIM RACE
100 10 EN USA
100 11 EN USA
100 12 EN USA
100 13 SP MX
200 14 SP MX
200 15
6 rows selected.
SQL> select * from den;
CERT REC PRIM RACE
100 01 EN USA
100 02 EN USA
100 03 EN USA
100 04 SP MX
200 06 SP MX
(cert,rec) uniquly identifies a person;
In Den table rec =med.rec-9 or rec =sub.rec-9 which implies
med sub den
(cert,rec)=(100,10)=(100,10)=(100,01)How can I find out how many people in the table where the PRIM and RACE hold different values.?Hi,
Perhaps this ,
with med as (
select 100 CERT, 10 rec, 'EN' prim, 'USA' race from dual union all
select 100 , 11, 'EN', 'USA' from dual union all
select 100 , 12, 'EN', 'USA' from dual union all
select 100 , 13, 'SP', 'MX' from dual union all
select 200 , 14, 'SP', 'MX' from dual union all
select 200 , 15, 'SP', 'MX' from dual )
sub as (
select 100 CERT, 10 rec , 'EN' prim, 'USA' race from dual union all
select 100, 11 , 'EN', 'USA' from dual union all
select 100, 12 , 'EN', 'USA' from dual union all
select 100, 13 , 'SP', 'MX' from dual union all
select 200, 14 , 'SP', 'MX' from dual union all
select 200, 15, null, null from dual )
den as (
select 100 cert, 01 rec, 'EN' prim, 'USA' race from dual union all
select 100, 02, 'EN' , 'USA'from dual union all
select 100, 03, 'EN' , 'USA'from dual union all
select 100, 04, 'SP' , 'MX'from dual union all
select 200, 06, 'SP' , 'MX'from dual )
----- sample data
select cert, prim, race ,count(rec) rec
from (
select *
from med
union all
select *
from sub
union all
select *
from den
group by cert, prim, race
ORDER BY 1,2,3
CERT PR RAC REC
100 EN USA 9
100 SP MX 3
200 SP MX 4
200 1HTH
SS -
good night,
I ended up making a purchase at Apple, but my credit card operator called me to confirm the values and was told different values than bought.
Purchases appeared as:
$ 159.70 (protocol 604627)
$ 137.00 (protocol 604538)
$ 105.39 (protocol 604468)
$ 0.01 (protocol 615633)
Could you check what is happening? Because I had to cancel my card for security.
Sincerely,np33td33 wrote:
My purchases were:
macBookPro
office 2011
iwork
ilife
and these purchases did not appear in the system credit card
Call Apple at 1800MYAPPLE. We just deal with MacBook Pro issues, and we have nothing to do with Apple. Please read what others have posted. -
Different values on form and database
hi all
i have a field which counts the number of rows
on the form which is showing a different value (which is correct)
and in the database it is showing a different value (incorrect)
i have issued commit
i am not understanding why this is happening ..
please help me
Mandarlistening for the first time but u r facing the problem, reconfirm that the query/properties are correct in form properties, check it by creating new form module for just checking weather it is showing correct in that form. and c if there is when_new_form_instance trigger or When_Validate_windows trigger used for some execution. and one more thing just check if u didnt change the column and create it again and database type is NO ( properties )
-
Dbms_lob.getlength() returns different values
Hi !
I am not a developer.. So, possibly cannot answer developer specific question.
We have two instances running on 10.2.0.4 but both giving different value for
declare
xml varchar2(32676) :=
'SELECT XT_STRATEGY, ACCT_DESCRIPTION,sum(MON_PL) PL_MON ,sum(TUE_PL) PL_TUE,sum(WED_PL) PL_WED ,sum(THU_PL) PL_THU, sum(FRI_PL) PL_FRI, sum(WTD_PL) PL_WTDPL,sum(WTD_PREMIUM_PL) PL_WTDPRMPL, sum(MTD_PL) PL_MARKPL,sum(MTD_PREMIUM_PL) PL_MTDPRMPL,sum(YTD_PL) PL_YTDPL,sum(YTD_PREMIUM_PL) PL_YTDPRMPL,
DLC_REGION,DLC_ENTITY FROM (SELECT xt_strategy, acct_description ,case when blankout_date < to_char( to_date( fv[EOD] )+ (1 -to_char(to_date(to_date( fv[EOD] )),''D''))) then 0 else MON_PL end as MON_PL, case when blankout_date < to_char( to_date( fv[EOD] )+ (1 -to_char(to_date(to_date( fv[EOD] )),''D''))) then 0 else tue_pl end as tue_pl,
case when blankout_date < to_char( to_date( fv[EOD] )+ (1 -to_char(to_date(to_date( fv[EOD] )),''D''))) then 0 else WED_PL end as WED_PL, case when blankout_date < to_char( to_date( fv[EOD] )+ (1 -to_char(to_date(to_date( fv[EOD] )),''D''))) then 0 else THU_PL end as THU_PL,
case when blankout_date < to_char( to_date( fv[EOD] )+ (1 -to_char(to_date(to_date( fv[EOD] )),''D''))) then 0 else FRI_PL end as FRI_PL, case when blankout_date < to_char( to_date( fv[EOD] )+ (1 -to_char(to_date(to_date( fv[EOD] )),''D''))) then 0 else WTD_PL end as WTD_PL,
case when blankout_date < to_char( to_date( fv[EOD] )+ (1 -to_char(to_date(to_date( fv[EOD] )),''D''))) then 0 else WTD_PREMIUM_PL end as WTD_PREMIUM_PL,
case when blankout_date < (select actual_date from tbl_date where date_type = ''PLMonthStart'' and to_char(actual_date, ''MMYYYY'') = to_char(to_date( fv[EOD] ),''MMYYYY'')) then 0 else mtd_pl end as mtd_pl,
case when blankout_date < (select actual_date from tbl_date where date_type = ''PLMonthStart'' and to_char(actual_date, ''MMYYYY'') = to_char(to_date( fv[EOD] ),''MMYYYY'')) then 0 else MTD_PREMIUM_PL end as MTD_PREMIUM_PL,
case when blankout_date < (select to_date(''01-JAN-''|| to_char(to_date((fv[EOD]),''DD-MON-YYYY''),''YYYY''),''DD-MON-YYYY'') from tbl_business_date) then 0 else ytd_PL end as ytd_PL,
case when blankout_date < (select to_date(''01-JAN-''|| to_char(to_date((fv[EOD]),''DD-MON-YYYY''),''YYYY''),''DD-MON-YYYY'') from tbl_business_date) then 0 else ytd_premium_PL end as ytd_premium_PL,
IN_STRIKECURR, IN_QUOTEDCUR, case dlc_region when ''LON'' then ''LN'' when ''NYC'' then ''NY'' when ''TOK'' then ''TK'' else dlc_region
end as DLC_REGION, DLC_ENTITY,DTL_REFERENCE,TRADE_STATE,blankout_date
FROM (select a.bo_book_id as xt_strategy, a.bo_book_id as acct_description , b.mon_pl, b.tue_pl, b.wed_pl,b.thu_pl,b.fri_pl,b.wtd_pl, b.wtd_premium_pl , b.mtd_pl , b.mtd_premium_pl, b.ytd_pl, b.ytd_premium_pl,
a.BASE_CCY as IN_STRIKECURR, A.QUOTED_CCY AS IN_QUOTEDCUR, a.region_code as dlc_region, a.entity_acronym as dlc_entity, TP.EBI_TRADE_ID AS DTL_REFERENCE, a.trade_state,
case when a.trade_state in (7,8,13) then a.amendment_date when a.maturity_date > nvl(a.premium_settlement_date, to_date(''01-JAN-1900'')) then
Case when a.trade_state in (4,5 ) then trunc(a.updated_date) else a.maturity_date end else a.premium_settlement_date end as blankout_date FROM TBL_TRADE_HIST A
join vw_feed_downstream_trade_id tp on a.trade_id = tp.trade_id and tp.mapping_source_name = ''ramfx''
join tbl_pl b on a.trade_id = b.trade_id and a.version = b.trade_version and b.pl_date = (select max(pl_date) from tbl_pl d where a.trade_id = d.trade_id and pl_date <= fv[EOD] )
join tbl_bo_book bk on a.bo_book_id = bk.bo_book_id and bk.business_Area = ''OPTIONS''
where b.pl_date < fv[EOD]
AND NOT EXISTS (SELECT 1 FROM TBL_EOD_TRADES D WHERE A.TRADE_ID = D.TRADE_ID AND D.BUSINESS_DATE = fv[EOD] )
UNION
SELECT A.XT_STRATEGY, A.ACCT_DESCRIPTION, C.MON_PL,C.TUE_PL, C.WED_PL,C.THU_PL, C.FRI_PL,C.WTD_PL,C.WTD_PREMIUM_PL,C.MTD_PL,C.MTD_PREMIUM_PL,C.YTD_PL,C.YTD_PREMIUM_PL,
A.IN_STRIKECURR, A.IN_QUOTEDCUR, A.DLC_REGION,A.DLC_ENTITY, A.DTL_REFERENCE , a.trade_state , case when a.trade_state in (7,8,13) then a.DLC_BUSDATEUPD when a.IN_EXPIRATION > nvl(a.XT_SETTLEDATE, to_date(''01-JAN-1900'')) then a.IN_EXPIRATION else a.XT_SETTLEDATE end as blankout_date
FROM VW_EBI_FEED A , TBL_EOD_TRADES B , TBL_PL C
WHERE A.TRADE_ID = B.TRADE_ID AND A.VERSION = B.TRADE_VERSION AND A.TRADE_ID = C.TRADE_ID
AND A.ACCT_RISKFEED = ''D'' AND A.DLC_DEALSTATE in (''LIVE'',''PENDING'',''CANCELLED'',''REVERSED'') AND A.VERSION = C.TRADE_VERSION
AND B.BUSINESS_DATE = to_date( fv[EOD] ,''DD-MON-YYYY'') AND C.PL_DATE = to_date( fv[EOD] ,''DD-MON-YYYY'')
UNION
SELECT A.BO_BOOK_ID AS XT_STRATEGY , A.BO_BOOK_ID AS ACCT_DESCRIPTION, a.MON_PL , a.TUE_PL , a.WED_PL, a.THU_PL , a.FRI_PL, a.WTD_PL ,a.WTD_PREMIUM_PL , a.mtd_pl, a.MTD_PREMIUM_PL,a.ytd_PL , a.ytd_premium_PL,A.BASE_CCY AS IN_STRIKECURR,A.QUOTED_CCY AS IN_QUOTEDCUR,
A.REGION_CODE as dlc_region ,A.ENTITY_ACRONYM AS DLC_ENTITY, A.MAPPING_SOURCE_ID AS DTL_REFERENCE, 12 as trade_state , a.PL_DATE as blankout_date
FROM TBL_PL_ARCH A , tbl_bo_book b where a.bo_book_id = b.bo_book_id and b.business_area = ''OPTIONS''
union
select d.bo_book_id as xt_strategy, d.bo_book_id as acct_description, case when to_char(b.pl_date,''D'') = 6 then (b.inception_pl + b.inception_premium_pl ) else (b.mon_pl * -1) end as mon_pl ,
case when to_char(b.pl_date,''D'') = 2 then (b.inception_pl + b.inception_premium_pl ) when to_char(b.pl_date,''D'') > 2 then (b.tue_PL * -1) else 0 end as tue_pl, case when to_char(b.pl_date,''D'') = 3 then (b.inception_pl + b.inception_premium_pl ) when to_char(b.pl_date,''D'') > 3 then (b.wed_pl * -1) else 0 end as wed_pl ,
case when to_char(b.pl_date,''D'') = 4 then (b.inception_pl + b.inception_premium_pl) when to_char(b.pl_date,''D'') > 4 then (b.thu_pl * -1) else 0 end as thu_pl ,case when to_char(b.pl_date,''D'') = 5 then (b.inception_pl + b.inception_premium_pl) when to_char(b.pl_date,''D'') > 5 then (b.fri_pl * -1) else 0 end as fri_pl ,
(b.mon_pl + b.tue_pl + b.wed_pl + b.thu_pl + b.fri_pl) * -1 + (b.inception_pl + b.inception_premium_pl) as wtd_pl, case when b.wtd_premium_pl <> 0 then b.wtd_premium_pl *-1 + (b.inception_premium_pl) else b.wtd_premium_pl end as wtd_premium_pl , case when b.mtd_pl <> 0 then b.mtd_pl * -1 + (b.inception_pl) else b.mtd_pl end as mtd_pl ,
case when b.mtd_premium_pl <> 0 then b.mtd_premium_pl * -1 + (b.inception_premium_pl ) else b.mtd_premium_pl end as mtd_premium_pl, case when b.ytd_pl <> 0 then b.ytd_pl * -1 + (b.inception_pl) else b.ytd_pl end as ytd_pl,
case when b.ytd_premium_pl <> 0 then b.ytd_premium_pl * -1 + (b.inception_premium_pl) else b.ytd_premium_pl end as ytd_premium_pl ,
c.base_ccy as IN_STRIKECURR,c.quoted_ccy as IN_QUOTEDCUR,c.region_code as dlc_region,c.entity_acronym as dlc_entity, to_char(c.trade_id) as dtl_reference,
8 as trade_state, case when to_char(b.pl_date,''D'') = 6 then b.pl_date + 2 else b.pl_date end as blankout_date
from tbl_trade_hist a
join tbl_pl b on a.trade_id = b.trade_id and a.version = b.trade_version
join tbl_trade_hist c on a.tradE_id = c.trade_id
join tbl_pl d on c.trade_id = d.trade_id and c.version = d.trade_version and d.pl_date = (select max(e.pl_date) from tbl_pl e where c.trade_id = e.trade_id and e.pl_date <= c.amendment_date)
join tbl_bo_book f on a.bo_book_id = f.bo_book_id and f.business_area = ''OPTIONS''
where (b.bo_book_id <> d.bo_book_id or a.region_code <> c.region_code or a.entity_acronym <> c.entity_acronym or a.base_ccy <> c.base_ccy or a.quoted_ccy <> c.quoted_ccy)
and d.pl_date - b.pl_date = case when to_char(d.pl_date,''DAY'') = ''MON'' then 3 else 1 end
and d.pl_date <= to_date( fv[EOD] ,''DD-MON-YYYY'')
union all
select b.bo_book_id as xt_strategy, b.bo_book_id as acct_description,case when to_char(b.pl_date,''D'') = 6 then (b.inception_pl * -1 + b.inception_premium_pl * -1) else (b.mon_pl ) end as mon_pl ,
case when to_char(b.pl_date,''D'') = 2 then (b.inception_pl * -1 + b.inception_premium_pl * -1) when to_char(b.pl_date,''D'') > 2 then (b.tue_PL) else 0 end as tue_pl, case when to_char(b.pl_date,''D'') = 3 then (b.inception_pl * -1 + b.inception_premium_pl * -1 ) when to_char(b.pl_date,''D'') > 3 then (b.wed_pl) else 0 end as wed_pl ,
case when to_char(b.pl_date,''D'') = 4 then (b.inception_pl * -1 + b.inception_premium_pl * -1 ) when to_char(b.pl_date,''D'') > 4 then (b.thu_pl ) else 0 end as thu_pl , case when to_char(b.pl_date,''D'') = 5 then (b.inception_pl *-1 + b.inception_premium_pl * -1) when to_char(b.pl_date,''D'') > 5 then (b.fri_pl) else 0 end as fri_pl ,
(b.mon_pl + b.tue_pl + b.wed_pl + b.thu_pl + b.fri_pl) + (b.inception_pl* -1 + b.inception_premium_pl * -1) as wtd_pl, case when b.wtd_premium_pl <> 0 then b.wtd_premium_pl + (b.inception_premium_pl * -1) else b.wtd_premium_pl end as wtd_premium_pl , case when b.mtd_pl <> 0 then b.mtd_pl + (b.inception_pl * -1) else b.mtd_pl end as mtd_pl ,
case when b.mtd_premium_pl <> 0 then b.mtd_premium_pl + (b.inception_premium_pl * -1) else b.mtd_premium_pl end as mtd_premium_pl, case when b.ytd_pl <> 0 then b.ytd_pl + (b.inception_pl * -1) else b.ytd_pl end as ytd_pl,
case when b.ytd_premium_pl <> 0 then b.ytd_premium_pl + (b.inception_premium_pl * -1) else b.ytd_premium_pl end as ytd_premium_pl ,
a.base_ccy as IN_STRIKECURR, a.quoted_ccy as IN_QUOTEDCUR, a.region_code as dlc_region,a.entity_acronym as dlc_entity, to_char(a.trade_id) as dtl_reference, 8 as trade_state,
case when to_char(b.pl_date,''D'') = 6 then b.pl_date + 2 else b.pl_date end as blankout_date
from tbl_trade_hist a
join tbl_pl b on a.trade_id = b.trade_id and a.version = b.trade_version
join tbl_trade_hist c on a.tradE_id = c.trade_id join tbl_pl d on c.trade_id = d.trade_id and c.version = d.trade_version and d.pl_date = (select max(e.pl_date) from tbl_pl e where c.trade_id = e.trade_id and e.pl_date <= c.amendment_date)
join tbl_bo_book f on a.bo_book_id = f.bo_book_id and f.business_area = ''OPTIONS''
where (b.bo_book_id <> d.bo_book_id or a.region_code <> c.region_code or a.entity_acronym <> c.entity_acronym or a.base_ccy <> c.base_ccy or a.quoted_ccy <> c.quoted_ccy)
and d.pl_date - b.pl_date = case when to_char(d.pl_date,''DAY'') = ''MON'' then 3 else 1 end and d.pl_date <= to_date( fv[EOD] ,''DD-MON-YYYY'') ))
group by xt_strategy,ACCT_DESCRIPTION,DLC_REGION,DLC_ENTITY';
c clob;
s varchar2(25000);
i numeric := 424;
begin
c := xml;
dbms_output.put_line('length of clob: ' || dbms_lob.getlength(c));
dbms_output.put_line('split clob at: ' || i);
dbms_output.put_line('desired substring length: ' || to_char(dbms_lob.getlength(c) - i));
s := dbms_lob.substr(c, dbms_lob.getlength(c) - i, i + 1);
dbms_output.put_line('length of substring: ' || length(s));
end;I checked for the database characterset and they are same - AL32UTF8
The result we get is
Output from MD1 database
length of clob: 10616
split clob at: 424
desired substring length: 10192
length of substring: 10192
Output from MD2 database
length of clob: 10616
split clob at: 424
desired substring length: 10192
length of substring: 8191Any idea why there is this discrepancy ?
Edited by: USER101 on Feb 19, 2010 4:24 PMThe EOF and the LF versus CR/LF could influence the count difference, yes.
Another explain could possibly be character set conversions. The BFILE I believe counts bytes, a CLOB would count "characters" - so if the source happens to contain a few multibyte characters (UTF), then the byte count would be larger than the character count.
To help you find the cause for your exact file, then I can suggest a couple of things you might do to explore the issue:
<li>Load the file into a BLOB instead of a CLOB and see what getlength() returns for the BLOB. BLOBs would also do byte counts and not try to treat the source as text.
<li>Save the CLOB back into the filesystem and compare the original file with the exported CLOB and check the differences with some filecompare tool. -
Different measures use same source column but gives different values in SSAS project
I've inherited a SSAS project. I'm currentlig gaining knowledge, but do not understand this: There are 4 measures that get data from same source table and column. Example measures:
[Started]
[Processing]
[Processed]
[Finished]
All of them gets data from a table (view), and a column "Event_count" with just value 0 in each row. Usage of the measure is "Count of non-empty values".
Correctly all of these measures gives different values, but I don't understand how since they all go against the same source column. I thougt maybe they were defined in Calculated measures, but nothing there. Where or what else could be affecting this behavior?
Bonus information (problem): One of the measures is returning blank/empty, which is why started with this research at all.
Help anyone?
regards .rHi ,
I would ask if all the measures are under the same measure group ? It is important to know, since in the dimension usage we are creating relationships between dimensions and measure
groups .
Did you try the delete all the calculation's code and leave only the " CALCULATE ; " part ? Do the values change after deploying the slim script ?
Are all properties the same ? defaults & caching ?
Regards, David . -
Column count doesn't match value count at row 1, unknown number of columns
Hi,
I am making a program to read data from excel files as the above and store them in tables. I have managed to read all the data from excel files as a string and store them in a table.
ID Name Salary
50 christine 2349000
43 paulina 1245874
54 laura 4587894
23 efi 3456457
43 jim 4512878
But in my project I have several other files that have same cell that are blank as the above example
ID Name Salary
50 christine 2349000
43 paulina
laura 4587894
23 3456457
43 jim 4512878
and when i ran the same program i get this exception :
SQLException: Column count doesn't match value count at row 1
SQLState: 21S01
VendorError: 1136The code for creating the table and inserting the values is above:
private static String getCreateTable(Connection con, String tablename,
LinkedHashMap<String, Integer> tableFields) {
Iterator iter = tableFields.keySet().iterator();
Iterator cells = tableFields.keySet().iterator();
String str = "";
String[] allFields = new String[tableFields.size()];
int i = 0;
while (iter.hasNext()) {
String fieldName = (String) iter.next();
Integer fieldType = (Integer) tableFields.get(fieldName);
switch (fieldType) {
case Cell.CELL_TYPE_NUMERIC:
str = fieldName + " INTEGER";
break;
case Cell.CELL_TYPE_STRING:
str = fieldName + " VARCHAR(255)";
break;
case Cell.CELL_TYPE_BOOLEAN:
str = fieldName + " INTEGER";
break;
default:
str = "";
break;
allFields[i++] = str;
try {
Statement stmt = con.createStatement();
try {
String all = org.apache.commons.lang3.StringUtils.join(
allFields, ",");
String createTableStr = "CREATE TABLE IF NOT EXISTS "
+ tablename + " ( " + all + ")";
System.out.println("Create a new table in the database");
stmt.executeUpdate(createTableStr);
} catch (SQLException e) {
System.out.println("SQLException: " + e.getMessage());
System.out.println("SQLState: " + e.getSQLState());
System.out.println("VendorError: " + e.getErrorCode());
} catch (Exception e)
System.out.println( ((SQLException) e).getSQLState() );
System.out.println( e.getMessage() );
e.printStackTrace();
return str;
private static void fillTable(Connection con, String fieldname,
LinkedHashMap[] tableData) {
for (int row = 0; row < tableData.length; row++) {
LinkedHashMap<String, Integer> rowData = tableData[row];
Iterator iter = rowData.entrySet().iterator();
String str;
String[] tousFields = new String[rowData.size()];
int i = 0;
while (iter.hasNext()) {
Map.Entry pairs = (Map.Entry) iter.next();
Integer fieldType = (Integer) pairs.getValue();
String fieldValue = (String) pairs.getKey();
switch (fieldType) {
case Cell.CELL_TYPE_NUMERIC:
str = fieldValue;
break;
case Cell.CELL_TYPE_STRING:
str = "\'" + fieldValue + "\'";
break;
case Cell.CELL_TYPE_BOOLEAN:
str = fieldValue;
break;
default:
str = "";
break;
tousFields[i++] = str;
try {
Statement stmt = con.createStatement();
String all = org.apache.commons.lang3.StringUtils.join(
tousFields, ",");
String sql = "INSERT INTO " + fieldname + " VALUES (" + all
+ ")";
stmt.executeUpdate(sql);
System.out.println("Fill table...");
} catch (SQLException e) {
System.out.println("SQLException: " + e.getMessage());
System.out.println("SQLState: " + e.getSQLState());
System.out.println("VendorError: " + e.getErrorCode());
}To be more specific the error it in the second row where i have only ID and Name in my excel file and only these i want to store. The third row has only Name and Salary and no ID. How i would be able to store only the values that i have and leave blank in the second row the Salary and in the third row the ID? Is there a way for my program to skip the blanks as empty value?
Edited by: 998913 on May 9, 2013 1:01 AMIn an unrelated observation, it appears you are creating new database tables to hold each document. I don't think this is a good idea. Your database tables should be created using the database's utility program and not programmatically. The database schema should hardly ever change once the project is complete.
As a design approach: One database table can hold your document names, versions, and date they were uploaded. Another table will hold the column names and data types. Another table can hold the data (type for all data = String). This way, you can join the three tables to retrieve a document. Your design will only consists of those three tables no matter how many unique documents you have. You probably should seek the advice of a DBA or experienced Java developer on exactly how structure those tables. My design is a rough layout. -
Time Dimension Type allows different values in attributes - Bug or Feature?
Not sure if this is a bug or a feature.
But if one has multiple hierarchies on a Time dimension. You have the ability to specify different values for member attributes in different hierarchies.
Example.
Hierarchy A has MIN_ID for it's Member and uses MIN_END_DATE for it's END_DATE
Hierarchy B has MIN_ID for it's Member and uses SESS_END_DATE for it's END_DATE
As per this post and David Greenfield's comment:
Dimension Sort issue when multiple mappings for different hierarchies
"Are you attempting to map the same attribute, SORT, to different columns in the two hierarchies? Put another way, do you expect the same member to have different values for the attribute in the two different hierarchies? If so, then this is a problem since a member must have the same value for the attribute regardless of the hierarchy."
Unlike a user dimension, a time dimension appears to allow this and it appears to work as intended. Is the behavior in this case intended to be different between a user and time dimension?I think that this is not a bug. There is an incompatibility in design which prevents you from using the same attribute differently for both hierarchies.
NOTE: Unlike parent relationship which depends on <dimension, dimension hierarchy>, Dimension Attribute is dependent on <dimension> alone, not dependent on <dimension, dimension hierarchy> combination. Hence it can only take on 1 value for 1 dimension member.
I think that the time dimension only appears to allow this. The key thing to check is for Time Dimension members which are common to both the hierarchies. Only one of the mappings will take effect (usually the hierarchy which is loaded last will remain in the aw/usable for queries, reports.. it would have over-written the earlier attribute value loaded as per the earlier hierarchy load).
Visualize a dimension as a long list of members which are built up contiguously on a per hierarchy, per level process using the mapping information saved. Once a member is defined (created) via Hierarchy A, it wont be created once again while loading Hierarchy B but is instead updated or redefined based on Hierarchy B's mapping info.
Assuming the dimension load attempts to load Hierarchy A first and then Hierarchy B,
* Dimension load for Hierarchy A will define the various members using MIN_ID and set the END_DATE attribute to value=MIN_END_DATE
* Dimension load for Hierarchy B will re-define the various members using MIN_ID and re-set or over-write the END_DATE attribute to value=SESS_END_DATE
* In this case, it looks like all members are common for both hierarchies (as both members are mapped to same column MIN_ID) and you would end up with END_DATE=SESS_END_DATE.
Actually whether all members are common to both hierarchies or not depends on the quality of data in your snowflake/star table: if parent level for Hierarchy A as well as Hierarchy B is setup fine then the members will be same set (overlapping in whole). If some rows for MIN_ID have parent column for Hierarchy A setup correctly but parent column for Hierarchy B =null or invalid value then that member will exist in Hierarchy A alone and would contain END_DATE=MIN_END_DATE as the corresponding update along Hierarchy B would fail due to hierarchy data quality issues (join from current level to parent level).
As regards a solution to your problem, you should not use the same attribute "SORT" for dual purpose (both hierarchies). Instead define attributes SORT_A and SORT_B and make them enabled for Hierarchy A, Hierarchy B respectively and map/use them appropriately in your reports.
HTH
Shankar -
Items in the shopping cart appear with different price than in the catalog
Hi All,
We are running SRM 5.0 (Classic Scenario) with external catalogues.
After selecting items from the external catalogue and transferring them to the shopping cart, the items appear with different price(the problem exists in the productive system)
The strange thing is that there is no dependence or sequence between the differences. For example, in one shopping cart, one item is with correct price, the price of the other item is not correct (when I click on the icon which is showing item details in the catalogue, the price is different than the one in the shopping cart). Sometimes the difference is significant, sometimes not - if the item price in the catalogue is 22.34 EUR, in the shopping cart is 21.22EUR or if the item is 45.62EUR in the shopping cart is 45.60 EUR. There is no logic.
I tried to create a shopping cart in the support system, with the same items from this catalogue, and they are sent back in SRM with the correct prices.
I traced all OCI parameters, sent from the supplier catalogue, and everything is correct.
At the example given below the price in the shopping cart ordered in the productive system is 69.00CZK, and after that during the test the correct price of 73.870CZK has appeared.
NEW_ITEM-DESCRIPTION==Durable-KeyClip-keytag%2C+black
NEW_ITEM-MATNR==
NEW_ITEM-MATGROUP==
NEW_ITEM-QUANTITY==10
NEW_ITEM-UNIT==EA
NEW_ITEM-PRICE==73.870
NEW_ITEM-PRICEUNIT==1
NEW_ITEM-CURRENCY==CZK
NEW_ITEM-NEW_ITEM-LEADTIME==1
NEW_ITEM-VENDOR==
NEW_ITEM-VENDORMAT==0176%2F1957001
NEW_ITEM-MANUFACTCODE==
NEW_ITEM-MANUFACTMAT==
NEW_ITEM-CONTRACT==
NEW_ITEM-CONTRACT_ITEM==
NEW_ITEM-SERVICE==
NEW_ITEM-EXT_QUOTE_ID==
NEW_ITEM-EXT_QUOTE_ITEM==
NEW_ITEM-EXT_PRODUCT_ID==23109
NEW_ITEM-EXT_SCHEMA_TYPE==UNSPSC
NEW_ITEM-EXT_CATEGORY_ID==55121504
NEW_ITEM-LONGTEXT_1%3A132==Durable-KeyClip%0D%0Akeytag%2Cblack%0D%0A%0D%0A6pc
I checked the error log in SLG1 for BBP_OCI, and no error message exists. In my opinion the problem can be in supplier system, because otherwise all items will be with wrong price. And at the moment, there are shopping carts in which all items are with the correct price!
It is not something in the user profile, because in one shopping cart created by one user some items are correct, some of them not.
I also checked with the supplier, they said that they haven't change the price, recently.
Has somebody of you met this problem?
In the IMG-> Define External Web Services (Catalogs, Vendor Lists etc.) I have set all parameters for the standard call structure: the URL of the supplier, our company ID and password for their catalogue.
In the Detail view for the catalogue, the following parameters are set
u201CAdditional functions in the product catalogueu201D field:
- Display product data again in the catalogue
- Validate product data from SAP Enterprise Buyer
- Find supply sources
u201CTechnical Settingsu201D field
- Use Error Log
Thanks,
DesiThat means that we are not maintaining material numbers in SRM, so there are no predefined price or info records for that materials in R/3 system, or in SRM.
In the set up of external catalogues, validation of the price is set. Which means that, if a new shopping cart is created from already existing one, and meanwhile, a change of the price is done by the supplier in the catalogue, the new item price will be adopted in the shopping cart.
No prices are maintained in the SRM system, everything is from the supplier catalogue.
Desi -
How to get different values in drop down in table rows
Hi
I have an application, which has a drop down in the table. Each row is to have different values in its drop down based on the "characteristic" parameter. For eg. first row has characteristic as color, and the corresponding drop down will contain the color names. Second row has charateristic as weight, and the drop down will carry corresponding weight values.
I am getting the data from the backend as a flat table i.e. charaterisitc - value pair.
I think i will have to use the Drop Down by Index control, but i dont know how exactly to go about it.
Can any one please help in this regard.
Thanks & regards,
AnupreetHi Maksim
I am sorry, but i am not able to get you.
This is the piece of code that i wrote for populating the drop down:
IPrivateMaintainDocAttribView.IDropElement dropEle = null;
for(int i = 0;i<size;i++)
dropEle = wdContext.nodeDrop().createDropElement();
dropEle.setDropval(wdContext.nodeCtxNode_DocAttribs().getCtxNode_DocAttribsElementAt(i).getCmpCtx_Value());
wdContext.nodeDrop().addElement(dropEle);
Here, Dropis the sub node to which i am putting the data and thisis linked to the table.
CtxNode_DocAttribs is the model node from where i am picking the data and setting in the subnode.
Thanks & regards,
Anupreet -
Creating a Material with different values for fields in Transaction MM01
Hello All,
While creating a material i will be giving a Profit Center in Sales:general/plant view, which i can see in Costing1 View. If i change this in this View it automatically changes in the other View. Is there any way to give different values in the two views or then what is the significance in showing the same field again in two different views.
Thanks,
Shashidhar.Hi,
Its just a way of showing the data in different views for user. It doesn't have any significance.
Regards,
Sudheer. -
Passing different values to the same servlet
Hi,
Is there a way to pass different values to the same servlet?
Background:
I have a database that I query to acquire a list of customers, then I show each customer as a link, that when clicked will show details of that customer. (The customer table is dynamic so I can't create a new page for each customer)
When using JSP what I do is
//Do query database
while (rst.next())
String cust = rst.getString ("cust");
out.write("<a href = \"cust2.jsp?cust=" + cust + " \" >" + cust + "</a> ");
}Then on the cust2.jsp. I will use
String str = request.getParameter ("cust");to acquire the customer to get details of.
Is there a way to do the same using servlets?
I could swap to JSP when creating this particular part of the project but it won't look good and it would help me learn a few things when there is another way.I want to know if there is a way to pass a variable from a webpage link like in my JSP example using servlets.
Here is what I wanted to do:
I have a webpage that contains customer names and each name has a link to the same servlet (let's say the link is famia/servb). I want servb to show detailed information about the customer my visitor clicked in the webpage.
The logic I was thinking is to pass a variable to this servlet, then I can use that variable to know which customer should I query in my database. So that I can show the details to my users.
Here lies my problem, I don't know how I can pass this variable, or even know which customer my visitor clicked. I can't use a new servlet for each client since the customer is in a database and if my customer base grows then I would need to create a lot more web page that does the same thing.
The JSP example I gave is how I will be coding it if I am using JSP, but now I am using servlets. So I was wodnering if there is a way to do this using servlet. Or should I stay with using JSP for this particular logic and just call servb after the JSP page acquired the variable.
I'm trying not to use "<original URL> + ? + <variable> = <value>" (eg: http://www.famia.net/customer?cust=famia) as the means for passing the variable. (or in the example as a means of passing variable cust with value famia) -
PDF for multiple users with different values
Is there a way to create a PDF to be sent to multiple users but have different values in the PDF? For expample employee A's offer letter is for $50/hour while employee B's offer letter is for $55/hour. But they have the same offer letter just with different values.
I have Enterprise EchoSign and FormsCentral.
Thank you!Hi,
Thanks for asking, but FormsCentral currently does not support this.
Perry -
I'm trying to put a hidden time stamp field on the bottom of all pages of a thousand page document, yet when I duplicate the field, the reproduced fields appear at different positions on different pages. Is there a way to make them all appear uniformly on each page. I've tried using the Lock function in the Properties menu before duplicating but to no avail. Please help.
I go to Tools>Forms> Edit...Do you want to detect...No. Add New Field>Text Field. I lay out my field at the bottom of the page, adjust the Properties (Hidden but printable, read only, font, alignment), Lock the Properties. Then I right-click and hit Duplicate.
-
LinkedHashMap problem (Same key but different value)
Dear Friends,
There is problem in LinkedHashMap for same key but different values.
I want both values of same key as Output.
Plz help me from an example code & it's output
LinkedHashMap<Object, LinkedList<Object>> linkhash = new LinkedHashMap<Object, LinkedList<Object>>();
LinkedList<Object> ll6 = new LinkedList<Object>();
LinkedList<Object> ll7 = new LinkedList<Object>();
LinkedList<Object> ll9 = new LinkedList<Object>();
objectName="Listitem";
ll6.add("id\tlisti");
ll6.add("tag\tlistcell");
ll6.add("tag\tlistcell");
linkhash.put(objectName, ll6);
System.out.println("List is "+linkhash);
objectName="Listcell";
ll7.add("id\tlistc");
ll7.add("label\tCEO");
linkhash.put(objectName, ll7);
System.out.println("List is "+linkhash);
objectName="Listcell";
ll9.add("id\tlistc1");
ll9.add("label\tNKC");
linkhash.put(objectName, ll9);
System.out.println("List is "+linkhash);
output is
List is {Listitem=[id listi, tag listcell, tag listcell]}
List is {Listitem=[id listi, tag listcell, tag listcell], Listcell=[id listc, label CEO]}
List is {Listitem=[id listi, tag listcell, tag listcell], Listcell=[id listc1, label NKC]}
I want output as
List is {Listitem=[id listi, tag listcell, tag listcell],Listcell=[id listc, label CEO], Listcell=[id listc1, label NKC]}
Plz help me
Thanks Friend
Edited by: kkcnkc on Apr 1, 2009 6:47 AMDouble post. Locking.
Maybe you are looking for
-
How to print a message in the Window created out of a Frame Object
Hello, I created a class extended from Thread class I want to print a message in Run method : in the Window created out of a Frame Object in the main function. I used System.out.println function, but nothing is printed on the screen what other functi
-
Hi all, i have created a form and a table and registered the table suing ad_dd package. my requirement is to create DFF on the form so that, i created a procedure and given code for "WHEN_NEW_FORM_INSTANCE" and also for WHEN_NEW_ITEM_INSTANCE after t
-
How to delete all photos on an I pad
HHow do I delete ALL the photos on my I pad?
-
Printing through Photoshop with applescript
I'm trying to set up a script that will automatically print a certain quantity based on user input. I can't figure out how to access the "Copies" part of the print menu. Is that possible? This is what I have so far. set myQuantity to the text returne
-
Old Remote Desktop license to add G5 to LAN
I got Apple Remote Desktop 3.6 for admin tasks in our LAN. Now, there is an older G5 in the LAN that I'd like to use for remote control. Question: How to get an older license of ARD (ARD 2.2 should be running with OS X 10.4.11)? Only thing I could fi