Help with Dynamic field replacement

Hi,
This is my problem. I have a table with two columns - PRINT , NAME.
The data in the two columns are : ("My name is <?NAME?>", "Micheal")
In BI Pub, I wrothe the dataset as " select PRINT, NAME from TABLE "
In templete builder, what should I do to get the final output as *" My name is Micheal"*
But I am getting "My name is <?NAME?>" I need to replace "<?NAME?>" with "Micheal". i.e dynamic Merge field replacement with in a field.
Hope I made it clear.....Help would be appreciated. I am a newbie here !!
Edited by: user2899051 on May 12, 2009 7:49 AM

You cannot parse the string as element :)
so , its not possible, you are trying to build the template from DB Table.
<?NAME?> , this syntax will be parsed by tempalte.
If you put it in String in XML. like [ MY Name is "<?NAME?>"] , it will considered as String. and not as a data element to be parsed.
Its not possible.
Instead of doing this,
<ROW>
<PRINT>Letter from</PRINT>
<TOBEPRINTED>1</TOBEPRINTED>
<NAME>Canaopy</NAME>
<ADDRESS> NY</ADDRESS>
</ROW>
- <ROW>
<PRINT>Send letter to </PRINT>
<TOBEPRINTED>2</TOBEPRINTED>
<NAME>Mann</NAME>
<ADDRESS> CA</ADDRESS>
</ROW>
</ROWSET>
If you can get the TOBEPRINTED column,
which indicates
what to be printed.
1- name
2- Address
we can write a if statement in template to display based on the value.
But again the position will be a problem, multiple replacement will be a problem
its like, creating the logic of display template in XML.

Similar Messages

  • Is it possible to make a search help with dynamic  selection table?

    Hi Experts,
    Is it possible to create search helps with dynamic seletion tables means
    i dont know the selection table names at the time of creation of search help.
    These tables will be determined at runtime.
    if yes, Please give an idea how to create and pass the table names at runtime.
    Thanks
    Yogesh Gupta

    Hi Yogesh,
    Create and fill your itab and show it with FM F4IF_INT_TABLE_VALUE_REQUEST
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield        = 'field to return from itab'
          dynpprog        = sy-repid
          dynpnr          = sy-dynnr
          dynprofield     = 'field on your screen to be filled'
          stepl           = sy-stepl
          window_title    = 'some text'
          value_org       = 'S'
        TABLES
          value_tab       = itab
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3.
    Darley

  • How to convert internal table with dynamic fields to XML

    Dear all,
    I met a problem like the following:
    The aim is to transform the following parameter to XML
    IT_FIELD stores the dynamic filed name of the internal table,with these fields, the dynamic internal can be created by cl_abap_tabledescr=>create(it_field)
    IT_VALUE stores the value of the internal table dynamically created with dynamic fields.
    For example
    IT_FIELD =>
    line1: FIELD1
    line2: FIELD2
    line3: FIELD3,
    three lines in this internal table.
    dynamically created internal table structure FIELD1 FIELD2 FIELD3
    And IT_VALUE=>
    1          2          3   (First line)
    11        22        33
    two lines of data.
    Do you have any idea about how to transform the IT_VALUE to XML here? And also the transformed XML to the IT_VALUE.( we may need remember IT_FIELD here for later XML to IT_VALUE.)
    Hope I describe the problem clearly.
    Any inputs will be appreciated.
    Edited by: Max Tang on Jan 12, 2009 3:46 PM
    Edited by: Max Tang on Jan 12, 2009 4:14 PM

    Hi,
    you need to implement a bit of coding for that.
    With the 'do varying' statement abap provides a loop over those fields. Within this loop you can build up a new internal table with one entry for each period and amount.
    kind regards
    Siggi
    PS: I am not very familiar with CO, but I guess there will be a standard extractor for that.

  • Need help with Dynamic Excel File Name please.

    I am try to output an excel file with dynamic date. 
    Here what I done.
    I am using SQL 2012.
    Create Execute SQL Task Connect Type: Excel
    Create Data Flow Task set to DelayValidation: True
    Create OLE DB Sourc
    Create Data Converstion
    Excel Destination
    Excel Connection, Expression, select ExcelFilePath
    @[User::sXLFilePath] +  @[User::sFileName] + RIGHT("0" + (DT_WSTR, 2) DATEPART("DD", GETDATE()), 2)+ RIGHT("0" + (DT_WSTR, 2) DATEPART("MM", GETDATE()), 2) + RIGHT((DT_WSTR,
    4) DATEPART("YYYY", GETDATE()), 2) +".csv"
    C:\ExcelOutPut\SOX_CAM_SQL_Report_010215.xls
    What I try to accomplish is output the file with each day append to it, date must be DDMMYY.
    I google it and found many samples, tested it, and none of them is work for me. 
    Any suggestions or some examples to share is greatly appreciate. 
    I am new to SSIS.  I found one poster have similar issue and inside the posted below, there was one suggestion to create variable and connection string but how do I bind that variable to Excel Connection manger.
    Please help.
    Thank you so much in advance.
    Ex: SOX_CAM_SQL_Report _020215.csv
           SOX_CAM_SQL_Report _030215.csv
    --Similar issue:
    https://social.msdn.microsoft.com/Forums/en-US/bda433aa-c8f8-47c9-9e56-efd20b8354ac/creating-a-dynamic-excel-file?forum=sqlintegrationservices
    Suggestion in the above posted but where can bind this to Excel Connection Manger. 
    Please help provide step by step.  Thanks.
    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\temp\\" + "ExcelTarget" + (DT_WSTR,4)DATEPART("yyyy",GETDATE())  +
    ".xls" + ";Extended Properties=\"EXCEL 8.0;HDR=YES\";"
    And yes, as you were intimating, the delay validation on the dataflow should be set.

    Hi NguyenBL,
    According to your description, you created ssis package to export data from database to excel, when the package runs, you want to create new excel and name the file with time stamp. If that is the case, we can achieve the goal by following steps:
    Create a script task used to create excel files.
    Create a data flow task to export data from database to excel.
    Add OLE DB source to data flow task.
    Add Excel Destination to data flow task.
    Create connection manager for OLE DB and Excel.
    Click Excel Connection Manager, in Properties window, click (…) button next to Expressions, then set ExcelFilePath with expression like below:
    "C:\\ETL Lab\\CreateNewExcel\\ExportData_"+REPLACE((DT_STR, 20, 1252)(DT_DBTIMESTAMP)@[System::StartTime], ":", "")+".xls"
    For detail information, please refer to the document:
    https://sqljourney.wordpress.com/2013/01/12/ssis-create-new-excel-file-dynamically-to-export-data/
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • Help with dynamic statement returning values into collection

    Hi All
    I am trying to use dynamic statement to return values into a collection using the returning clause. However, I get an ORA-00933 error. Here is a simple setup:
    create table t(
        pk number,
        id_batch varchar2(30),
        date_created date,
        constraint t_pk primary key ( pk )
    create or replace type num_ntt is table of number;
    create or replace type vc2_ntt is table of varchar2(30);
    create or replace
    package pkg
    as
      type rec is record(
          pk        num_ntt,    
          id_batch  vc2_ntt
      procedure p(
          p_count in number,
          p_rt    out nocopy rec
    end pkg;
    create or replace
    package body pkg
    as
      procedure p(
          p_count in number,
          p_rt    out nocopy rec
      is
      begin
          execute immediate '
          insert into t
          select level, ''x'' || level, sysdate
          from   dual
          connect by level <= :p_count
          returning pk, id_batch into :pk, :id_batch'
          using p_count returning bulk collect into p_rt.pk, p_rt.id_batch;
      end p;
    end pkg;
    declare
      r  pkg.rec;
    begin
      pkg.p( 5, r );
    end;
    /

    sanjeevchauhan wrote:
    but I am working with dynamic statement and returning multiple fields into a collection.And using an INSERT...SELECT statement combined with a RETURNING INTO clause still does not work. Whether it's dynamic SQL or not: it doesn't work. The link describes a workaround.
    By the way, I don't see why you are using dynamic SQL here. Static SQL will do just fine. And so you can literally copy Adrian's setup.
    Regards,
    Rob.

  • Need Help with Sony Hybrid replacement tips

    Hey all,
    First post here, so please excuse me if I've posted in the wrong section. Earlier this month I ordered myself the Sony Hybrid EPEX10A/BLK Replacement Earbuds from Amazon.com. While attempting to get a large tip on my Sennheiser CX500s, the colored part broke. I now only have one large tip, which is currently fitting the CX500 just fine. I really need another large tip, and I don't know what to do. I thought the best option would be to contact Sony Support and ask for a replacement (I'm assuming my warranty is still in effect, don't know anything), but I don't know how. I went to this (http://esupport.sony.com/US/perl/contact-land.pl) website and selected technical support, and since I couldn't find my product in the list, I typed in what I thought was the model number, and it came up with no results. I have no idea where the model number is on the packaging (which I still have).
    Can somebody please help me get a replacement? Other than the broken tip, these are the best tips I have had , and I would really like to continue using them.
    Thanks for the help!
    Solved!
    Go to Solution.

    Contact the Sony Parts and Accessories team - they have a different number to Sony Technical Support and should be able to locate the correct part for you - details on the following link:
    https://servicesales.sel.sony.com/ecom/ ... /index.jsp

  • Dynamic Internal Table with Dynamic Fields

    Hi all,
    My scenario is fairly simple----
    --> End user clicks a button on screen and he gets the list of HR tables.
    --> Then selects a table and list of all the fields for that table gets displayed.
    --> He/she selects the fields they want data to be retrieved for.
    So, the requirement is, the dynamic internal table should get created with the fields selected.
    The select statement should only retrieve fields which were selected by the end user
    and from the table selected by the end user.
    I  believe the fields selected by end user can be passed by a variable of  type string.
    something like this---
    select (fields)
    from (p_table)        " Table selected by end user
    into  dynamic internal table.   " should contain columns selected by end user"
    Appreciate your inputs and guidance.
    Warm regards,
    Hari Kiran

    TYPE-POOLS :ABAP.
    Parameters P_TAB      TYPE        DDOBJNAME.
    DATA  : GO_LINE_TYPE  TYPE REF TO CL_ABAP_STRUCTDESCR,
            GO_TABLE_DESC TYPE REF TO CL_ABAP_TABLEDESCR,
            GS_COMPONENTS TYPE        ABAP_COMPONENTDESCR,
            GT_COMPONENTS TYPE        ABAP_COMPONENT_TAB,
            GR_TAB        TYPE REF TO DATA,
            GT_FIELDS  TYPE TABLE OF DFIES WITH HEADER LINE.
    FIELD-SYMBOLS: <GT_TABLE> TYPE TABLE,
                   <GS_TABLE> TYPE ANY,
                   <GV_VALUE> TYPE ANY.
    CALL FUNCTION 'DDIF_FIELDINFO_GET'
      EXPORTING
        TABNAME              = P_TAB
    *   FIELDNAME            = ' '
    *   LANGU                = SY-LANGU
    *   LFIELDNAME           = ' '
    *   ALL_TYPES            = ' '
    *   GROUP_NAMES          = ' '
    *   UCLEN                =
    * IMPORTING
    *   X030L_WA             =
    *   DDOBJTYPE            =
    *   DFIES_WA             =
    *   LINES_DESCR          =
    TABLES
        DFIES_TAB            =  GT_FIELDS
    *   FIXED_VALUES         =
    EXCEPTIONS
       NOT_FOUND            = 1
       INTERNAL_ERROR       = 2
       OTHERS               = 3.
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT GT_FIELDS.
      CLEAR GS_COMPONENTS.
      GS_COMPONENTS-NAME  = GT_FIELDS-FIELDNAME.
      GS_COMPONENTS-TYPE ?= CL_ABAP_STRUCTDESCR=>DESCRIBE_BY_NAME( GT_FIELDS-ROLLNAME ).
      APPEND GS_COMPONENTS TO GT_COMPONENTS.
    ENDLOOP.
    GO_LINE_TYPE  = CL_ABAP_STRUCTDESCR=>CREATE( GT_COMPONENTS ).
    GO_TABLE_DESC = CL_ABAP_TABLEDESCR=>CREATE( GO_LINE_TYPE ).
    CREATE DATA:  GR_TAB TYPE HANDLE GO_TABLE_DESC.
    ASSIGN:  GR_TAB->* TO <GT_TABLE>.
    SELECT * FROM (P_TAB) APPENDING CORRESPONDING FIELDS OF TABLE <GT_TABLE>.
    LOOP AT <GT_TABLE> ASSIGNING <GS_TABLE>.
      NEW-LINE.
      DO.
        ASSIGN COMPONENT SY-INDEX OF STRUCTURE <GS_TABLE> TO <GV_VALUE>.
        IF SY-SUBRC NE '0'.
          EXIT.
        ENDIF.
        WRITE : <GV_VALUE>.
      ENDDO.
    ENDLOOP.

  • Help with dynamic SQL

    Hello,
    I have the following function that works ok:
    CREATE OR REPLACE FUNCTION Get_Partition_Name (sTable VARCHAR2, iImportIndex INTEGER)
    RETURN VARCHAR2 IS
    cursor c is select A.partition_name from (select table_name, partition_name,
    extractvalue (
    dbms_xmlgen.
    getxmltype (
    'select high_value from all_tab_partitions where table_name='''
    || table_name
    || ''' and table_owner = '''
    || table_owner
    || ''' and partition_name = '''
    || partition_name
    || ''''),
    '//text()') import_value from all_tab_partitions) A where table_name = sTable and A.import_value = iImportIndex;
    sPartitionName VARCHAR(20);
    err_num NUMBER;
    BEGIN
    open c;
    fetch c into sPartitionName;
    IF c%ISOPEN THEN
    CLOSE c;
    END IF;
    RETURN sPartitionName;
    EXCEPTION
    WHEN OTHERS THEN
    err_num := SQLCODE;
    --save error in log table
    LOG.SAVELINE(SQLCODE, SQLERRM);
    END Get_Partition_Name;
    I am trying to replace the cursor statement with dynamic SQL, something like (see below) but it doesn't work any more; I think I am missing some quotes.
    CREATE OR REPLACE FUNCTION Get_Partition_Name (sTable VARCHAR2, iImportIndex INTEGER)
    RETURN VARCHAR2 IS
    TYPE t1 IS REF CURSOR;
    c t1;
    sSql VARCHAR2(500);
    sPartitionName VARCHAR(20);
    err_num NUMBER;
    BEGIN
    sSql := 'select A.partition_name from (select table_name, partition_name,
    extractvalue (
    dbms_xmlgen.
    getxmltype (
    ''select high_value from all_tab_partitions where table_name=''''
    || table_name
    || '''' and table_owner = ''''
    || table_owner
    || '''' and partition_name = ''''
    || partition_name
    || ''''''),
    ''//text()'') import_value from all_tab_partitions) A where table_name = :a and A.import_value = :b';
    OPEN c FOR sSql USING sTable, iImportIndex;
    fetch c into sPartitionName;
    IF c%ISOPEN THEN
    CLOSE c;
    END IF;
    RETURN sPartitionName;
    EXCEPTION
    WHEN OTHERS THEN
    err_num := SQLCODE;
    --save error in log table
    LOG.SAVELINE(SQLCODE, SQLERRM);
    END Get_Partition_Name;
    Please advise,
    Regards,
    M.R.

    Assuming the requirement is to find the partition in the supplied table with the supplied high value and the issue is that dba/all_tab_partitions.high_value is a long, one alternative along the same lines as you've done already is as follows. (I've just used a cursor rather than a function for simplicity of demo).
    SQL> var r refcursor
    SQL> set autoprint on
    SQL> declare
      2   ctx dbms_xmlgen.ctxhandle;
      3   v_table_name VARCHAR2(40) := 'LOGMNR_USER$';
      4   v_value      NUMBER       := 100;
      5  begin
      6   ctx := DBMS_XMLGEN.NEWCONTEXT
      7          ('select table_name
      8            ,      partition_name
      9            ,      high_value  hi_val
    10            from   dba_tab_partitions
    11            where  table_name     = :table_name');
    12   dbms_xmlgen.setbindvalue(ctx,'TABLE_NAME',v_table_name);
    13   open:r for
    14   with x as
    15   (select xmltype(dbms_xmlgen.getxml(ctx)) myxml
    16    from   dual)
    17   select extractvalue(x.object_value,'/ROW/TABLE_NAME') table_name
    18   ,      extractvalue(x.object_value,'/ROW/PARTITION_NAME') partition_name
    19   ,      extractvalue(x.object_value,'/ROW/HI_VAL') hi_val
    20   from   x
    21   ,      TABLE(XMLSEQUENCE(EXTRACT(x.myxml,'/ROWSET/ROW'))) x
    22   where  extractvalue(x.object_value,'/ROW/HI_VAL') = v_value;
    23  end;
    24  /
    PL/SQL procedure successfully completed.
    TABLE_NAME
    PARTITION_NAME
    HI_VAL
    LOGMNR_USER$
    P_LESSTHAN100
    100
    SQL> I'm sure there are other ways as well. Especially with XML functionality, there's normally many ways to skin a cat.

  • Help with dynamic page layouts

    Hello JSP Gurus,
    I'm attempting to dynamically generate the page layout for my site based on the organization a user belongs to. Basically, I'd have certain resources like navigation links, graphics, etc, that are modular. Then I'd like to construct the layout using these "moduls" in a dynamic fashion. Does anyone have any suggestions on techniques or technologies that would be useful? I'm not really looking at the portal/portlet model. Is this something that Cocoon could do by storing the layout for each customer as an XML file or something? Any ideas, suggestions, experiences would be helpful.
    Thanks!

    How does Tiles differ from the JetSpeed apache
    project? They both appear to be portal-like
    frameworks, or am I incorrect about that? Which is
    preferred?Frankly, I can't give you an in-depth answer to that. Maybe someone else can help with more details.
    What I can tell you is that JetSpeed seems to be more of a real portal architecture. Emphasis is placed on the framework portion, interfacing with exisiting applications. Visual layout takes second seat to this.
    Tiles on the other hand puts more emphasis on visual layout and reuse.
    Just looking at JetSpeed's visual interfacing a little bit makes me really dislike it. You build tables and such inside of a servlet, so there's a tight coupling (or at least, much tighter than with Struts/Tiles) between the presentation and logic. (I'm basing this on a JavaWorld article at
    http://www.javaworld.com/javaworld/jw-07-2001/jw-0727-jetspeed.html )
    Based on your initial question, it would seem to me that tiles is much closer to what you're looking for (and likely easier to just pick up and use).
    Anyway, take all this with a grain of salt; I'm not exactly an expert on JetSpeed. =)

  • Help with dynamic text and and css !

    My second question of the day.
    I'm trying to build a feature in my app in which the user can
    hide/reveal
    bolding and or
    italics and or
    underlining. The text is being loaded in from an xml file
    and I was thinking about styling it with css in order to get the
    underlining. My problem is that the only way I can think about
    pulling this off is to have a css style sheet that has a defined
    bold,italic and underline class defined- - then another one that
    just has a italic and underline class defined -- then another one
    that has just a bold and underline class defined . . . and so on
    and so on. You can see why I would prefer a much more streamlined
    system. Unfortunately my experience with dynamic text styling is
    somewhat limited. Hopefully someone can help me out here.

    Perfect. I knew it was some little snippet that I was
    forgetting. I made a temporary fix of creating a 0% alpha box over
    the button like a fake click area above the text, and that worked
    but I know that it was a half-arsed way of working around it.
    Thanks.

  • Help with Required fields-PLEASE

    I have been attempting to get help with a required field and one of the forum helpers said he got it to work for me but I cannot and I have not been able to get any more responses from him to help me further.
    I am attempting to have a radio box when the YES is selected to require another field to be completed.  The script I was provided with is:
    getField("Location").required = (getField("Group1").value == "Yes");
    Location being the field that I require to be filled in if Group 1 is Yes.  The previous forum helper indicated that I had to have this script in both fields in Group 1 and when I do that, nothing different happens. 
    What am I doing wrong? 
    Please, I need to fix this right away and I will be using this java script on many other forms that I have so I need to get this done soon.
    Thank you in advance.

    Wht you want can get somewhat complicated. One way to prevent subsequent fields from being used is to set them to read-only and/or hidden. You could then use the Validate event of the text field to validate the entry and enable the subsequent fields if it is filled-in adequately. In general, you should also reset the fields whenever you hide them, so they don't contain potentially invalid data from previously being filled-in. So you could initially have the fields set to be hidden, and only unhide them if No is selected, or if Yes is selected and the required text field is filled-in.
    I realize this may not be as helpful as you had hoped for, but I can't suggest specific code without knowing more about the form.

  • URGENT: Help with dynamic borders!

    Hello all -
    I DESPERATLY need help with this! I am using the code from
    kirupa's xml photo gallery with the thumbnails. right now the alpha
    changes on mouseover, fine...but my client is demanding that it
    draw a border instead. I have been at this for about a week and
    have NO idea how to do this...i have looked at things like API's
    and things...but my main issue is that the images and MC's are all
    created on the fly and i dont know how to code in an on mouseover
    draw a border type of function, no idea at all!
    This is my code as it sits now, PLEASE SOMEONE HELP ME!!!
    thank you in advance!

    really could use some help quick here guys

  • Help with dynamic playlist for mpd

    Hi guys,
    I use mpd with sonata for playing my music, and after trying exaile there is one thing id really like for mpd, and that is the dynamic playlist function.
    When you're playing a song in exaile with dynamic playlist enabled, it queries audioscrobbler and automatically adds similar artists/songs to your playlist (if you have them on your pc).
    I dont want to use exaile as it just feels too big and slow and bloated (not KISS ), i know a little bit of python so i thought i'll try and make my own little script/program as Sonata has audioscrobbler support, but i dont think there is anyway to query similar artists.
    I think im going to try and make this as a daemon type program that will run in the background adding songs to the playlist.
    Ive found the code from the exaile source (audioscrobbler.py) which queries lastfm e.g.
    >>> lips = AudioScrobblerQuery(artist='The Flaming Lips')
    >>> for artist in lips.similar():
    ... print artist.name, artist.mbid
    This will print a list of similar artists to the flaming lips.
    I've not done much with python so i thought this would be a good way to try and improve.
    Does anyone have any suggestions as to what the best way to go about searching and comparing the results to my mpd database, would the best way just to be to search the mpd.db?
    And if anyone else has any ideas/comments id like to hear them.
    Edit:
    I just found this too, so i may only need to change some things to integrate it with mpd rather than amarok
    http://www.kde-apps.org/content/show.php?content=31920
    Thanks
    Last edited by Kane (2008-06-05 13:24:33)

    well i just modified the patch into a little script, it does what i need
    its here if anyone wants it
    import audioscrobbler
    import mpd
    import random
    import time
    lastsong = {}
    def timer_control():
    get_similar()
    time.sleep(10)
    timer_control()
    def get_similar():
    audioscrobbler
    client = mpd.MPDClient()
    client.connect("localhost", 6600)
    mpdstatus = client.status()
    prevsonginfo = client.currentsong()
    global lastsong
    if mpdstatus['state'] == "stop": return
    if prevsonginfo == lastsong: return
    lastsong = prevsonginfo
    similarartists = ""
    song = prevsonginfo
    #if not song: break #No song, do nothing
    prevartist = song['artist']
    # Is the info already cached?
    similar_cache = {}
    if similar_cache.has_key(prevartist):
    similarartists = similar_cache[prevartist]
    else:
    #Not cached so fetch from Audioscrobbler
    try:
    similarartists = [artist.name for artist in audioscrobbler.AudioScrobblerQuery(artist=prevartist).similar()]
    # Cache search results and save some time next search
    similar_cache[prevartist] = similarartists
    except audioscrobbler.AudioScrobblerError:
    similar_cache[prevartist] = None # Empty cache
    return # Do nothing!
    if not similarartists: return # Empty list
    # Split list in half and sort upper half
    # this means good matches will have priority
    # but makes sure artist A does not always result in artist B
    half_idx = len(similarartists)/2
    upperhalf = similarartists[:half_idx]
    lowerhalf = similarartists[half_idx:]
    random.shuffle(upperhalf)
    artistlist = upperhalf
    artistlist.extend(lowerhalf)
    # Try each artist in order
    for artist in artistlist:
    try:
    print "Trying:",artist
    songs = client.search("artist", artist)
    if not songs: continue
    selected_song = random.sample(songs, 1)[0]
    client.add(selected_song['file'])
    print "Added", selected_song['title'],"by",selected_song['artist']
    # Delete old song from playlist?
    break
    except mpd.MPDError, e:
    print "MPDError", e.message
    continue
    except ValueError, e:
    print "ValueError:",e.message
    continue
    timer_control()
    Last edited by Kane (2008-06-06 16:22:49)

  • Please help with dynamic form field names in cfloop

    Hi,
    I need to create a form with day, date, month, year and time for 12 months
    Instead of coding them 12 times, I create day,date,month,year and time fileds in my form 1 time and then I use cfloop from="1" to="12" index="i" to loop these form fields 12 times.
    I gave each form field name such as: <input type="text" name="ScheduleDate_# i #" value=" "> this way each of those field will be named differently such as:
    ScheduleDate_1, ScheduleDate_2,ScheduleDate_3, ScheduleTime_1,ScheduleTime_2, etc
    I'm facing problem when this form is submitted, I think the error has something to do with the pound sign (##) when it comes to updating the back end
    I use MS SQL
    It doesn like this:
    <CFLOOP From="1" To="12" index="k">
    <CFIF Len(Trim(Form.MeetYear_#k#)) NEQ 0 AND Len(Trim(Form.MeetTime_#k#)) NEQ 0>
    <cfquery name="CreateSchedule" datasource="#DSN#">
    UPDATE TableSchedule 
    SET SchedDay = <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.SchedDay_#k##">,SchedMonth =
    <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.SchedMonth_#k##">,SchedDate =
    <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.SchedDate_#k##">,SchedYear =
    <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.SchedYear_#k##">,SchedTime =
    <cfqueryparam cfsqltype="cf_sql_varchar" value="#form.SchedTime_#k##">
    Where SchedId = <cfqueryparam cfsqltype="cf_sql_numeric" value="#k#">  
    </cfquery>
    </CFIF>
    </CFLOOP>
    Can anyone help please?

    You can't nest hash marks. Do this instead:
    SET SchedDay = <cfqueryparam cfsqltype="cf_sql_varchar" value="#form["SchedDay_" & k]#">
    Dave Watts, CTO, Fig Leaf Software
    http://www.figleaf.com/
    http://training.figleaf.com/

  • Help with Dynamic Objects

    Hi All,
    New to Flex and wanted to get some help from the public.
    Basically, here's what I want to do.
    I have a tab navigator with multiple tabs. Each tab has a
    datagrid on it. When you click the tab, the grid should update to
    new data based on the tab clicked. That's no problem. The problem
    I'm running into is that because the data is taking a while to
    retreive from the server, users are getting the previous's tabs
    datagrid until the information is updated. I wanted to do two
    things:
    1) Change the cursor to a "thinking" or "processing" icon
    where clicks can't be done until the full data has been retreived
    and updated. This is a nice to have; i haven't the slightlest clue
    on how to accomplish this.
    2) In lieu/addition to #1, i wanted the datagrid to be
    dynamic. Meaning, if you go to the tab, it'll add dynamically the
    datagrid to the tab and then show the data.
    Here's my code, but it doesn't work very well. Any help i can
    get from you guys would be great:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="horizontal" initialize="createDataGrid()">
    <mx:Script>
    <![CDATA[
    import mx.controls.DataGrid;
    import mx.managers.PopUpManager;
    import mx.collections.ArrayCollection;
    import mx.controls.Alert;
    import mx.rpc.events.ResultEvent;
    import mx.containers.HBox;
    import mx.containers.TabNavigator;
    [Bindable]
    private var infoDataGrid:ArrayCollection;
    [Bindable]
    private var currentID:String;
    [Bindable]
    private var dynDataGrid:DataGrid;
    private function createDataGrid():void {
    dynDataGrid = new DataGrid;
    dynDataGrid.dataProvider=infoDataGrid;
    dynDataGrid.width=80;
    private function getDataFromServer(event:ResultEvent):void {
    var numOfRecords:int = event.result.result_set.num_rows;
    if (numOfRecords > 0 ) {
    infoDataGrid = event.result.result_set.results.result as
    ArrayCollection;
    } else {
    // no information retrieved worry about this later
    private function mainBuilder( event:Event ):void {
    var tabNavigator:TabNavigator = TabNavigator( event.target
    var pattern:RegExp = /\D/gi;
    if (tabNavigator.selectedChild.id != "NewTab") {
    // Remove all non-digits from LID
    var str:String = tabNavigator.selectedChild.id;
    currentID=(str.replace(pattern, ""));
    phpHTTPService.send();
    // loop through all children and remove any datagrids while
    adding to the current one
    for (y=0; y<tabNavigator.numChildren; y++) {
    var tmpNavID:String = tabNavigator.childDescriptors[y].id
    if ((tmpNavID == tabNavigator.selectedChild.id) &&
    (tmpNavID != "")) {
    // this does not work as intended...
    tabNavigator.selectedChild.addChild(dynDataGrid);
    } else {
    // this does not work.
    //How do you access something directly with an ID but
    represented by a variable?
    // tmpNavID.removeChildAt(0);
    } else {
    // New Tab selected, do something here
    ]]>
    </mx:Script>
    <mx:HTTPService id="phpHTTPService"
    url="/flex/php/AssetsInLocation.php" useProxy="false" method="GET"
    result="getDataFromServer(event)">
    <mx:request xmlns="">
    <lid>{currentID}</lid>
    </mx:request>
    </mx:HTTPService>
    <mx:TabNavigator id="tabNav"
    creationComplete="tabNav.selectedIndex=0;mainBuilder(event)"
    width="100%" change="mainBuilder(event);">
    <mx:HBox id="LID2345" label="Tab 1" width="100%"
    height="100%" horizontalAlign="center">
    <!-- <mx:DataGrid dataProvider="{infoDataGrid}"
    width="80%"/> -->
    </mx:HBox>
    <mx:HBox id="LID1111" label="Tab 2" width="100%"
    height="100%" horizontalAlign="center">
    <!-- <mx:DataGrid dataProvider="{infoDataGrid}"
    width="80%"/> -->
    </mx:HBox>
    <mx:HBox id="LID1234" label="Tab 3" width="100%"
    height="100%" horizontalAlign="center">
    <!-- <mx:DataGrid dataProvider="{infoDataGrid}"
    width="80%"/> -->
    </mx:HBox>
    <mx:Canvas id="NewTab" label="New..." width="100%"
    height="100%">
    </mx:Canvas>
    </mx:TabNavigator>
    </mx:Application>
    Thanks all for your assistance.

    I think Ned is on the right track, but the specific form of
    the command may be off. If the ProgressEvent handler is defined on
    MC_Holder_Image, then the command to get the
    MC_Holder_Preload_TextField object should be something like:
    var oTextField:TextField =
    this.parent.parent.MC_Holder_Preload.getChildByName(childname);
    oTextField.text = "some text";
    The first "parent" references MC_Holder_Sprite, the second
    MC_Holder. If there are several instances of MC_Holder_Preload,
    then the above would have to be modified to account for that by
    first using the getChildByName method to acquire the appropriate
    instance like so:
    var oMC:MovieClip =
    this.parent.parent.getChildByName(HolderPreloadName);
    var oTextField:TextField = oMC.getChildByName(TextFieldName);
    Hope this (a) makes sense, (b) helps and (c) actually works.
    Regards
    Dave Spaar

Maybe you are looking for

  • How to not "read" Junk Messages In Lion Mail?

    In the new setup in Lion Mail, the left column now has the subject line and first couple lines of the message. To create any kind of action with the message, I have to select it.  It then appears on the right and is seen as opened mail. For most mess

  • Apple TV loosing Signal with TV

    After about a year of using Apple TV all of a sudden it started cutting out.  The picture then comes back and cuts out again and so on.   Tried upgrading, didn't fix it.  So can an Apple TV device break?  Was working and now, not so much !!!

  • Authentication cookie "X-SMP-SESSID"

    Hi, I would like to know where is the authentication cookie "X-SMP-SESSID" saved. I am sending request through SMP server, where the user is authorized against LDAP. Once the request is authorized (using user credentials) my application received the

  • [SOLVED] MPD is not starting with .xinitrc

    Hi! This is my first post on this forum, so hello everyone! Let me explain you what my problem is: I just can't get MPD to start with. xinitrc or systemd. When I launch it from terminal it works like a charm, but when it should start with X (I am usi

  • External Firewire Drive Has Now Showing mounting with Intilize

    i have a seagate 1tb external firewire drive. its been working and has about 500gigs of info on it. today it is showing up as a unformatted drive. disk warrior is not seeing it. is there another program that could repair maybe tech tool or any other