mercoledì 18 aprile 2012

MSTR metadata: extracting objects info


MSTR:_ADM is the schema where the metadata are stored.
Accessing the schema you can extract some info.
We used them to build a map with tags for the user.

--Query PROJECT
select 
a.OBJECT_NAME, a.OBJECT_ID, a.DESCRIPTION , a.*
from MSTR_ADM.DSSMDOBJINFO  a 
where a.SUBTYPE in ('8192')


--Query REPORT

select 
a.OBJECT_NAME, a.OBJECT_ID, a.DESCRIPTION 
from MSTR_ADM.DSSMDOBJINFO  a 
where a.SUBTYPE in ('768','769')
and a.PROJECT_ID = '0EDCC01C4F4704248627968B3DD51238'



--Query ATTRIBUTES
select 
a.OBJECT_NAME, a.OBJECT_ID, a.DESCRIPTION , a.*
from MSTR_ADM.DSSMDOBJINFO  a 
where a.SUBTYPE in ('3072')
and a.PROJECT_ID = '0EDCC01C4F4704248627968B3DD51238'


--Objects used by a Report
select 
 a.*,
 d.*
from MSTR_ADM.DSSMDOBJDEPN  a
join MSTR_ADM.DSSMDOBJINFO  d on a.DEPN_OBJID = D.OBJECT_ID and a.PROJECT_ID = D.PROJECT_ID
where a.PROJECT_ID = '0EDCC01C4F4704248627968B3DD51238'
and a.OBJECT_ID = '219330A34F97C354FE1FC287EC8A6324'
order by D.SUBTYPE, D.OBJECT_NAME





DSSMDOBJINFO is the main table you'll want.  It has the Name of every object as well as the Object Type, so you'll be joining to this guy a lot.  For Object Type, you can build your own lookup table by just checking what a few objects are stored as.  I think there is a bigger list somewhere, but in the MD they only store the number.  You'll also find Parent_ID which is the Folder an object is in.  Very useful for building tree structures and filtering out for only objects in Public Objects.
DSSMDOBJDEPN is the Object Dependency table.  Here you'll find Object_ID and DEPN_OBJID.  There is the table you can use to climb up from a Column to a Report.
DSSMDOBJDEFN (or *DEF2 in 9.0.1) sadly, this table contains the real gold which is the definition of each object.  It's encoded a few layers deep (binary encoded, compressed, ascii encoded) for performance, so you can't get any useful information out of it.  But if you're ever trying to query for a specific bit of information you can't find anywhere else about an object, good change its there.
DSSMDOBJSECU is the security table.  Trust_ID is the User/Group who has access, and RIGHTS is a hash of the kind of access they have (View, Full, Custom).  Trial and error can decode the Rights for you.
DSSCSSUBINST has your Distribution Services Subscriptions.  Pretty straight forward table.
DSSMDOBJLOCK locks table
DSSMDOBJPROP properties table, generico
DSSMDOBJTRNS traductions
DSSMDOBJSECU
DSSMDOBJCMNT comments




Error on exporting XLS from a web document? Try checking the freeform !

Yesterday  I was checking a web document with a problem on exporting in XLS format:
while opening the exported document, office answered with this error:
HTML ERROR in Cell Value
The error message continued with a log placed in a windows temporary  folder containing a series of values without a specific difference with all the other values. The values were all in a specific column.

The problem was with the xls formatting of the column:
MSTR exported the column as number containing text:

The source of the problem was...
the Freeform mapping in the dataset underneath the document !

The value in the column was mapped as attribute ID (numeric) instead of attribute DESC (textual).
Modifing the mapping the problem was solved.

Excuse my English. I hope the content is more interesting.

problem:
xls exporting from web document, "HTML ERROR in Cell Value"


solution:
correct Freeform mapping





venerdì 13 aprile 2012

how to build a filter with comparison on dates with prompts

First of all you have to build two prompts yearmonth_TO and yearmonth_FROM that you will use to select from list or write the text of the ID and a prompt n_month to enter the number of months you want to analyze.


You have to create a filter using "advanced qualify" and then use those strings:


Filter with prompts on date between:
ApplyComparison ("#0 is not null AND #0  BETWEEN #E1 and #E2"; yearmonth@ID; ?[ yearmonth_TO]; ?[ yearmonth_FROM])



Comparison last 12 months:
ApplyComparison (" #0 between  to_number(to_char(add_months(to_date(#E1, 'yyyymm'), - 11 ), 'yyyymm')) and #E1 ";  yearmonth@ID; ?[ yearmonth_TO ])

From date entered to date entered + n months:

ApplyComparison (" #0 between  #E1 and to_number(to_char(add_months(to_date(#E1, 'yyyymm'), + #E2 -1), 'yyyymm'))  ";  yearmonth@ID; ?[ yearmonth_FROM ] ; ?[n_month])