How to dynamically create sql statement for Defaulting Segment Values?

Hi,
Navigation:
1) Descriptive/Segments
2) Query for DFF to be modified
3) Uncheck “Freeze Flexfield Definition”
4) (B) Segments
5) Segments Summary form opens
6) (B) open - Segments form opens
Now, here I want to specify Default type as "SQL Statement" and in the default value field I want to use SQL statement with parameters (to evaluate the default value).
The parameters should be pass at runtime from the form in which we have this DFF. The parameters value should be one of the values which get evaluated at runtime in the form window.
Please suggest how we can achieve this?
Or is there any alternative to achieve this?
Thanks!!
Regards,
Narender
Edited by: Narender Singh on Mar 30, 2010 7:47 AM
Edited by: Narender Singh on Mar 30, 2010 7:48 AM

Jason,
it is possible, though not so simple as with a report.
What you need to do is to create a pipelined function, that returns your date and count data. This pipelined function can be the base of a pseudo-table, which can be used in a select. For the pipelined function you need to define types for one row and a table to define the return-type for your function:
create or replace type calendar_row as object (date_time date, description varchar2(250));
create type calendar_table as table of calendar_row;
Then you can create the package with the function:
================================================
create or replace package dyn_calendar is
procedure set_query(i_query in varchar2);
function view_source return calendar_table pipelined;
end;
create or replace package body dyn_calendar is
v_query varchar2(100) := null;
procedure set_query(i_query in varchar2) is
begin
v_query := i_query;
end;
function view_source return calendar_table pipelined is
TYPE cursor IS REF CURSOR;
c_cal cursor;
v_date_time date := null;
v_description varchar2(100) := null;
r_cal calendar_row;
begin
open c_cal for v_query;
fetch c_cal into v_date_time, v_description;
loop
exit when c_cal%notfound;
r_cal := calendar_row(v_date_time, v_description);
pipe row(r_cal);
fetch c_cal into v_date_time, v_description;
end loop;
return;
end;
end;
================================================
Now you can set query in a PL/SL region before the calendar:
dyn_calendar.set_query(SELECT count(*), ' || :P8_SOURCE_DATE || ' FROM ' || :P8_SOURCE_TABLE || ' GROUP BY ' || :P8_SOURCE_DATE);
and you can base your calendar on the query:
select * from table(dyn_calendar(view_source))
Good luck,
Dik

Similar Messages

  • How would I create buttons states for MCs I am creating abstract MCs

    I am creating a generic website that would have abstract MCs that would load jpg or TXT fields for the user interface to allow for fast updates to the site. The MCs that would make up the user interface would be empty and load things into it using XML or PHP later on. How would I create button states for the user interface MCs.  I started creating a function for every MC button state but I thought there might be a more efficient way.
    would creating a array help in this case?
    and is using URLRequest the way to link to pages with in a movie well the flash movie that is the site it's self?
    /*---------------------------- THE START OF MY ACTION SCRIPT ------------------------------*/
    var waywardLogo_mc:MovieClip = new MovieClip;
    var theCollection_mc:MovieClip = new MovieClip;
    var newsPage_mc:MovieClip = new MovieClip;
    var whatthe#$@!doyouwant!?_mc:MovieClip = new MovieClip;
    /*---------------------------- onOver ------------------------------*/
    waywardLogo_mc.addEventListener(MouseEvent.ROLL_OVER,onOver);
    theCollection_mc.addEventListener(MouseEvent.ROLL_OVER,onOver);
    newspage_mc.addEventListener(MouseEvent.ROLL_OVER,onOver);
    whatthe#$@!doyouwant!?_mc.addEventListener(MouseEvent.ROLL_OVER,onOver);
    /*---------------------------- onOut ------------------------------*/
    waywardLogo_mc.addEventListener(MouseEvent.ROLL_OUT,onOut);
    theCollection_mc.addEventListener(MouseEvent.ROLL_OUT,onOut);
    newspage_mc.addEventListener(MouseEvent.ROLL_OUT,onOut);
    whatthe#$@!doyouwant!?_mc.addEventListener(MouseEvent.ROLL_OUT,onOut);
    /*---------------------------- onClick ------------------------------*/
    waywardLogo_mc.addEventListener(MouseEvent.CLICK,onClick);
    theCollection_mc.addEventListener(MouseEvent.CLICK,onClick);
    newspage_mc.addEventListener(MouseEvent.CLICK,onClick);
    whatthe#$@!doyouwant!?_mc.addEventListener(MouseEvent.CLICK,onClick);
    function onOver(event:MouseEvent):void
    event.target.alpha = .5;
    function onOut(event:MouseEvent):void
    event.target.alpha = 1;
    function onClick(event:MouseEvent):void
    event.target.URLRequest("");
    /*---------------------------- onover, onOut, onClick buttonModes ------------------------------*/
    waywardLogo_mc.buttonMode = true;
    theCollection_mc.buttonMode = true;
    newspage_mc.buttonMode = true;
    whatthe#$@!doyouwant!?_mc.buttonMode = true;

    click insert/new symbol, tick movieclip, assign a name, tick export for actionscript and in the class textfield enter a name (say ButtonClass) and click ok.
    attached to the first frame of your new movieclip, type stop() in the actions panel.  put whatever graphic you want on-stage for your button's up stage.  create another keyframe, label it "over" and put whatever graphic you want for button's over state on-stage.
    in a layer above those graphics, you'll probably want to add a dynamic textfield so each of your buttons can have different text.  assign the textfield and instance name (say tf) and extend its timeline to the last frame of your movieclip button.
    then when you want to create a button, on your timeline you can use:
    var b:ButtonClass=new ButtonClass();  // these two lines need to be entered for each button
    buttonhandlerF(b,someX,someY);
    //-------code between dotted lines only needs to be entered once no matter how many buttons you add --------------------
    function buttonhandlerF(b:ButtonClass,x:Number,y:Number){
    b.addEventListener(MouseEvent.MOUSE_OVER,overF);
    b.addEventListener(MouseEVent.MOUSE_OUT,outF);
    b.x=x
    b.y=y
    addChild(b);
    function overF(e:MouseEvent){
    e.currentTarget.gotoAndStop("over");
    function outF(e:MouseEvent){
    e.currentTarget.gotoAndStop(1);
    //-------code between dotted lines only needs to be entered once --------------------
    // you'll also want to create a click listener and listener function
    the code between the dotted lines is amenable to being added to a ButtonClass.as class file if want to expand your capabilities.

  • How to monitor/capture SQL statement for an event?

    I want to capture all sql statements for 10 minutes that ran against the database. How should i do that?
    Thanks,
    Dave

    The following document will give u the requred know how.
    http://www.oracle.com/technology/products/manageability/database/pdf/ow05/PS_S001_274001_106-1_FIN_v1.pdf

  • Tyring to dynamically create SQL statment for an SQL Calendar

    Is there a way to dynamically create an SQL statement that an SQL Calendar would use. I don't see an option to create a PL/SQL Calendar.
    For example I want to pass a table name, and the corresponding date column to items on the calendar page, and then have the SQL Calendar use those to fields to display the number of records loaded into the specified table. I've written the following but it doesn't work:
    'SELECT count(*), ' || :P8_SOURCE_DATE || ' FROM ' || :P8_SOURCE_TABLE || ' GROUP BY ' || :P8_SOURCE_DATE;
    Does anyone know if there is a why to create a PL/SQL Calendar?

    Jason,
    it is possible, though not so simple as with a report.
    What you need to do is to create a pipelined function, that returns your date and count data. This pipelined function can be the base of a pseudo-table, which can be used in a select. For the pipelined function you need to define types for one row and a table to define the return-type for your function:
    create or replace type calendar_row as object (date_time date, description varchar2(250));
    create type calendar_table as table of calendar_row;
    Then you can create the package with the function:
    ================================================
    create or replace package dyn_calendar is
    procedure set_query(i_query in varchar2);
    function view_source return calendar_table pipelined;
    end;
    create or replace package body dyn_calendar is
    v_query varchar2(100) := null;
    procedure set_query(i_query in varchar2) is
    begin
    v_query := i_query;
    end;
    function view_source return calendar_table pipelined is
    TYPE cursor IS REF CURSOR;
    c_cal cursor;
    v_date_time date := null;
    v_description varchar2(100) := null;
    r_cal calendar_row;
    begin
    open c_cal for v_query;
    fetch c_cal into v_date_time, v_description;
    loop
    exit when c_cal%notfound;
    r_cal := calendar_row(v_date_time, v_description);
    pipe row(r_cal);
    fetch c_cal into v_date_time, v_description;
    end loop;
    return;
    end;
    end;
    ================================================
    Now you can set query in a PL/SL region before the calendar:
    dyn_calendar.set_query(SELECT count(*), ' || :P8_SOURCE_DATE || ' FROM ' || :P8_SOURCE_TABLE || ' GROUP BY ' || :P8_SOURCE_DATE);
    and you can base your calendar on the query:
    select * from table(dyn_calendar(view_source))
    Good luck,
    Dik

  • Preparing Dynamic SQL statement for inserting in Pro*C

    Hi Friends,
    From quite some time i am struggling writing Dynamic SQL statement for dynamic insert and update in Pro*C.
    Can somebody go through my code and suggest me the rigth way of doing.
    Right now it throws an error saying " Error while updating ORA-00904: invalid column name "
    Please help me.
    Girish.
    int main()
    EXEC SQL BEGIN DECLARE SECTION;
    char *uid ="scott/tiger";
    static char sqlstmt[129];
    struct /* DEPT record */
    int dept_num;
    char dept_name[15];
    char location[14];
    } dept_rec;
    EXEC SQL END DECLARE SECTION;
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    EXEC SQL CONNECT :uid;
    dept_rec.dept_num = 50;
    strcpy(dept_rec.dept_name,"ADMIN");
    strcpy(dept_rec.location,"IN");
    strcpy(sqlstmt,"UPDATE dept set DNAME = dept_rec.dept_name where DEPTNO = dept_rec.dept_num");
    EXEC SQL EXECUTE IMMEDIATE:sqlstmt;
    EXEC SQL COMMIT;
    exit(0);
    void sql_error()
    printf("\nError while updating %s",sqlca.sqlerrm.sqlerrmc);
    EXEC SQL ROLLBACK;
    }

    A bit rusty here but this is how I see it.
    Think of it this way ..
    all Oracle is going to see is:
    UPDATE dept set DNAME = dept_rec.dept_name where DEPTNO = dept_rec.dept_num
    Its NOT going to know what dept_rec.dept_name is or dept_rec.dept_num is ..
    it doesnt go back and fill in those values.
    You need something like
    strcpy(sqlstmt,"UPDATE dept set DNAME = \"");
    strcat(sqlstmt,dept_rec.dept_name);
    strcat(sqlstmt,"\" where DEPTNO = ");
    strcat(sqlstmt,dept_rec.dept_num);
    printf(sqlsmt); # Just to be sure the update statement look right during testing.

  • How to create sql query for item master with operator LIKE with variables?

    hi all,
    How to create sql query for item master with
    operator LIKE(Contains,Start With,End With) with variables using query generator in SAP B1 ?
    Jeyakanthan

    Hi Jeyakanthan,
    here is an example (put the like statement into the where field)
    SELECT T0.CardCode, T0.CardName FROM OITM T0 WHERE T0.CardName Like '%%test%%'
    The %% sign is a wildcard. If you need start with write 'test%%' and otherwise ends with '%%test'. For contains you need '%%test%%'. You also could combinate this statements like 'test%%abc%%'. This means starts with test and contains abc.
    Regards Steffen

  • How do you create a save as default folder for MP3 files used Captivate text to audio voices files?

    How do you create a save as default folder for MP3 files used Captivate text to audio voices files?

    Hi Ed
    Thank you for contacting me, however I already know how to save text to
    audio files via timeline using the Export feature.
    So my question was not entirely clear and I apologize for that.  To explain
    further, whenever I save a text to audio file, captivate takes me to a
    default save as folder where I then have browse back to my production
    folder where I am keeping all my Txt to Aud files.  This is very tedious
    process when you have alot of files to save.  So my question was is there a
    way to configure captivate so I can make my production folder the default
    file for whenever I save a Txt to Audio file through Export feature that
    the system automatically takes me to that production folder, and I am
    spared the long tedious process of saving the file manually to the
    prodcution folder I want.
    I have copy the pathway to the production folder in the URL filed in the
    Save As dialoge box and that workaround as cut the work down but I still
    have to paste that URL field to point the file to the right folder. So it
    would be nice if I could do everything automatically.  Microsoft makes this
    capability in their MS Office applications, so I was thinking Adobe might
    do the same thing.  Your help with this would be appreicated,
    Thanks
    Merrill Roberts
    Sr. Training Specialist
    SunGard Availability Services
    Direct 925-831-7730
    Mobile:415-215-9280

  • How to put the SQL-statement returned value into the field (as a default)

    Hi,
    I am using Developer/2000 (Forms Designer) under windows 98.
    Please tell me how to put the SQL-statement value (as a default value) into the field before enter-query mode. Noted that I have tried the following ways but still some problems:-
    1) Place the SQL-statement into PRE_QUERY trigger in the form/block level.
    There is a message box which ask 'Do you want to save the changes?'.
    2) Place the SQL-statement before execute enter_query. There is still a
    message box which ask 'Do you want to save the changes?'.
    Any hints? Thanks. Urgent.

    solved it!
    1) Suppress DEFAULT save message
    if form_failure then
    raise form_trigger_failure;
    end if;
    2) Place the default value before enter-query.
    Ref: Title='Default value in query field in ENTER_QUERY mode' in designer forum by CVZ
    form level trigger
    ============
    WHEN-NEW-ITEM-INSTANCE
    =======================
    if :system.mode = 'ENTER-QUERY' then
    :block.item := 'default waarde';
    end if;
    3) Suppress the changes whenever leaving the default field.
    if :block.item is null then
    -- assign statement
    end if;

  • How to trace every dml statement for a schema/ database

    hi,
    how to trace every dml statement for a schema/ database
    PFile Entrie
    init.ora Parameter Example event='1401 trace name errorstack, level 12';
    tkprof orcl_ora_3632.trc b.txt
    after these two steps I am not able to see the sql statements in trace ...
    Please suggest.
    Thanks & Regards,

    Hi,
    Trace Event 1401 will create a trace file and dumps the information when ORA-01401 error occurs. This error occurs when "inserted value too large for column"
    You will see the trace file getting populated only when you encounter ORA-01401 error.
    Regards

  • How set dynamically created query in GridControl?

    How set dynamically created query in GridControl?
    Thank you

    If your dynamic query is based on an Entity object, then you can probably use RowSetInfo setQueryInfo method.
    The argument to this method is a 'Query' object. There are three flavours provided in the oracle.dacf.dataset
    package.
    oracle.dacf.dataset.QueryViewInfo
    defines an updateable SQL query based on a predefined BC4J View Object.
    oracle.dacf.dataset.QueryStatementInfo
    Creates a view object based on an arbitrary SQL statement.
    oracle.dacf.dataset.QueryInfo
    Creates a View Object from an Entity Object and additional SQL clauses. The View Object will have
    that Entity Object as its sole Entity Object base.
    If in your application you are able to specify the name of the entity, then you can use the QueryInfo method to define your
    query. Please try the following.
    SessionInfo si = ....
    void runDynamicQuery()
    RowSetInfo rsi = new RowSetInfo();
    AttributeInfo ai = new AttibuteInfo(..);
    ai.setName(..);
    rsi..addChild(ai);
    si.addChild( rsi)
    rsi.setQueryInfo( new QueryInfo( ...../* include entity name */ .... ));
    rsi.setName(....);
    rsi.open(true);
    grid.setDataItemName(...);
    Hope this helps,
    Sathish.

  • How can I create a form for users wherein the text field will expand to accommodate additional text?

    How can I create a form for users wherein the text field will expand to accommodate additional text?

    You need to use LiveCycle (PC Only) to create a dynamic form like that.
    The best you can do with Acrobat to view all of the text in a field is to set the field to multiline, and set the size to "Auto" (If you don't set the size to 'Auto', you can enter as much text as you wish, but the user will need to use the scrollbar to view all of the text.)

  • HT4191 iPhone Local Storage "My iPhone" - How do you create this folder for use by the Notes app on a iPhone or iPad?  If I want to keep some notes only on my device and not in a cloud environment associated with an e-mail account.

    iPhone Local Storage "My iPhone" - How do you create this folder for use by the Notes app on a iPhone or iPad?  If I want to keep some notes only on my device and not in a cloud environment associated with an e-mail account.  I've seen reference to the  "My iPhone" local storage put no mention on how you create this folder or access this folder within the Notes app.  I realize storing information in a local storage like this provides no syncing between other iDevices but that is exactly what I'm looking for.  I'm running iOS7.0.4 on a iPhone 5S, and a iPad Air.  Any help would be greatly appreciated.

    If you go to Settings > Notes > Default Account you will see "On My iPhone" as the default account and the only choice if you have not enabled syncing Notes in Settings >iCloud or Settings > Mail, Contacts, Calendars. If you have enabled syncing you can still select "On My iPhone" as the default account. When you are in the Notes app you won't see any accounts listed if you have not enabled syncing because they are all in the On My iPhone account and that is the only place possible. It is not a folder that you create.

  • How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column

    Please Help!!!
    How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column.
                                      January 2014         January
    2013                            +/-
                    Region   Entry   Exit  Total    Entry   Exit   Total   (Total of Jan2014-Total of Jan2013)
                    A               2         3      
    40        5       7        30                    40-30= 10

    What is a table structure? Sorry cannot test it right now..
    SELECT <columns>,(SELECT Total FROM tbl WHERE Y=2014)-(SELECT Total FROM tbl WHERE Y=2013)
    FROM tbl
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Pass ORG_ID as sql statement for parameter in request set

    We are in a multi-org environment. We are running the request PRC: Generate Draft Revenue for a Single Project as part of the request set. We want the request to automatically fill in the open pa period as the accrue through date. We have been using the SQL Statement below as the value for the accrue through date parameter.
    select end_date
    from pa_periods_all
    where status = 'O'
    and current_pa_period_flag = 'Y'
    Unfortunately that does not limit to a specific company. We a company that still have DEC-05 while another has an open period of JAN-06. This is causing the program fits. How do I pass the org_id to the request? [in beginners terms please]
    Thanks.
    Anne

    No idea what might be wroong without more info...
    Do some output. Test the ${params.id} variable passed to the second jsp. If that is correct, then error is in the select statement or display of jsp2. If it is correct the error comes from jsp1.
    If I have to guess, then I would say the error comes from JSP1, and the ${row.vac_id} should only be called once. In which case I would do something like this:
    //in jsp 1
                <c:forEach var="row" items="${results.rows}"  varStatus="counter"  >
                    <c:set var="vac_id" value="${row.vac_id}" scope="page"/>
                    <tr>
                        <td>${vac_id}</td>
                        <td><a href="vacancydetails.jsp?id=${vac_id}">More</a></td>But that is a guess only...
    Errr... Hold on to that as reference, but the it is entirely likely that I misspelled ${params.id} It may be ${param.id} I forget and away from my machine right now...

  • How to write the sql statement of my finder function in cmp?

    hi,
    I create a cmp ejb from table INFOCOLUMN,and I create a my finder function ,which sql statement is :
    select * from INFOCOLUMN WHERE employee_id=id
    employee_id is a column of the table,and id is the finder function parameter.
    The error is : invalid column name
    So,how to write the sql statement.
    Thanks .

    Mole-
    Bind variables are of the form $1, $2, etc., so your query stmt should look like:
    select * from INFOCOLUMN WHERE employee_id=$1
    -Jon

Maybe you are looking for

  • Is there a way to filter out TV shows when looking at the "purchased" playlist?

    I have playlist highlighted on the top of itunes and the I see the music box showing up.  On the lft hand side I selected the "purchased " playlist, but included in that are the the TV Shows I have purchased for my son.  So when I play and hit shuffl

  • New user account. help pls.

    after filling up the fields on creating new account then click the "create account", the new account should show up under the "other accounts" but it doesn't show up. Am i missing something here, help please. thanks.

  • Buttons not working on new T61

    I just got a T61 with no OS and installed XP Pro and then got drivers from lenovo site.  The ThinkVantage button, sound buttons next to it, the hotkeys (FN+F?) and trackpoint center button not working.  Any suggestions?

  • MacBook Pro won't boot, sleep light is on, nothing else

    Help! I've got a late 2007 MacBook Pro that got a new HD under warranty in late 2008. It's worked great through last night until this morning. This am, when I turn it on (fully charged and plugged in), it won't boot. The machine makes a little noise,

  • How do I disable business catalyst?

    I have unknowingly signed up for business catalyst and it has disable ability to test webpages on browsers.  Each time an ftp server error window pops up. At this point, I just would like to disable the catalyst feature and set dreamweaver back to or