Dynamic creating field names within Loop

Hi,
I've a record which comprises of a few key fields and then 52 qty fields, one for each week of the year. ( Not my design honest!!).
Anyway with in a Cursor there are currently 52 "IF" statements clearing out values less than the current week number. I'd tried to replace this with the following. However I'm having trouble with the " 'c1_rec.qty'| |lv_count " bit.
Has anyone got any ideas?
lv_week:=22; ( added for clarity )
lv_count:=1;
WHILE lv_count < lv_week LOOP
'c1_rec.qty'&#0124; &#0124;lv_count :=0;
lv_count:=lv_count+1;
END LOOP;
John-Paul Thompson

John-Paul;
If I understand the question correctly, you have a table with 52 columns, one for each week of the year. You are trying to zero the quantity for each week prior to the current week. I'm going to take a sab at this. Bear in mind that I have no way to debug the code.
DECLARE
c NUMBER;
n NUMBER;
v_sql VARCHAR2(2000)
lv_week NUMBER:=22; ( initialize week#)
lv_count NUMBER:=1;
BEGIN
v_sql := 'UPDATE c1_rec SET '
WHILE lv_count < lv_week LOOP
v_sql := v_sql&#0124; &#0124;
'qty'| |TO_CHAR(lv_count) &#0124; &#0124;' :=0';
lv_count:=lv_count+1;
IF lv_count < lv_week THEN
v_sql := v_sql &#0124; &#0124; ', ';
END IF;
END LOOP;
--sql := v_sql &#0124; &#0124; YOUR WHERE CLAUSE
c:= dbms_sql.open_cursor;
dbms_sql.parse(c, v_sql, dbms_sql.native)
n:= dbms_sql.execute(c);
dbms_sql.close_cursor(c);
END;
HTH
Randall
null

Similar Messages

  • Accessing dynamically created fields

    Hi,
    I have a html that has an input field on it. Say we enter a number( e.g. 5) and submit the html.
    The html transfers control to 1. jsp which creates input fields based on the number entered. In the above example 5 input(text) fields are created dynamically.
    Once I submit 1.jsp, it transfers control to another 2.jsp.
    In 2.jsp, I need to access the values entered in the 5 fields on 1.jsp.
    request.getparameter() returns value only from the 1st field (out of the 5 fields). How to access the remaining fields ?
    Any help is really appreciated.
    Thanks,

    Thanks a lot. That worked!!!!
    Even the ordering seem to be ok.
    With your other suggestion, I had tried that before but that did not work.
    I created field names as field1,field2..etc on the fly and stored this in a String variable - fileName.
    <% fileName = fileName concatinated with number %>
    <input type = "text" name=fileName > Note: There are no quotes around fileName. So fileName could be fileName1, fileName2 etc
    (I don't think the quotes around name attribute really matters.)
    When I say request.getparameter("fileName") it returned only the 1st fileName. Let me know what youythink.
    Thanks again.

  • HR - dynamic selections field name and field value in the program

    HI all,
       I am using dynamic selections for a HR report.
    I have created a view with 20 fields and added it to HR report category ___00003(All fields suppressed).
    I need to check these fields in the program. But i am not able to get the field name and value in the program for dynamic selections fields.
    Please let me know how to get the field names and values in the program for dynamic selections .
    Thanks,
    Kranthi.

    You have to read the itab <i>pnpdynse</i> in your Program to obtain the Dynamic Selection values. This itab has a deep structure.. you can set a break point in one of the events before <b>get pernr</b> & in the debug mode, you will able to display the itab <i>pnpdynse</i>.. you can then identify how to get the values into your code..
    ~Suresh

  • How to Edit names within Loop Library

    I've edited a MIDI Apple Loop from Jam Packs and saved it as an MIDI Apple Loop in the library.
    What I typed in as a name for the file is not what appeared in the loop library?
    1. Why did the text alter from I typed?
    2. How can I edite the name in the within loop library.
    3. How do I delete apple loops I've created from the apple loop library?
    Thank you
    - I did look in the manual and within the user help in Logic, but could find nothing. I know I must be looking under the wrong 'key word' search.
    What can I say!
    Message was edited by: StyleSupport

    StyleSupport wrote:
    1. Why did the text alter from I typed?
    You must select the green loop in the Arrange and go to Region menu "Add loop to the library" something like that or drag and drop the region to the Library in the Media dock.
    This way a new dialog will show( see the picture below ) where you need to fill new "unique" name or to add some user (sub name), choose the group etc.
    2. How can I edite the name in the within loop library.
    3. How do I delete apple loops I've created from the apple loop library?
    You "user" green loop is stored to ...user/Library/Audio/Apple Loops/User Loops.
    Browse to this dir and edit or delete the loop.
    You "user" green loop is stored to ...user/Library/Audio/Apple Loops/User Loops.
    Browse to this dir ( you will find a folder labeled as "Single" or something like that open it ) and edit or delete the loop in question.
    !http://img42.imageshack.us/img42/508/greenloops.gif!
    !http://img59.imageshack.us/img59/4967/aglogo45.gif! [www.audiogrocery.com|http://www.audiogrocery.com]

  • How to dynamically list field names

    Hello,
    I have a DB Link to a SQL 2000 Server and can connect and retrieve using Heterogenous Servives.
    Let say I issued a Select (eg., Select * from tab@remote1), how do I dynamically list each field name from the result?
    Thank you.

    The best way to deal with dynamic column names from a SQL result is to use a cursor describe interface.
    A SQL SELECT may not select all the columns from a table. It may join tables. It may add derived and calculated columns to the result.
    None of these will be seen when using the data dictionary. Also, using a remote heterogeneous data dictionary? That does not sound like a sensible approach to me.
    In PL/SQL, one can create DBMS_SQL cursors. These cursors can be "described" - i.e. the describe interface for a cursor tells you what the contents are, the column names, the data types, the precision, etc.
    Using DBMS_SQL allows you to describe any result set from any SELECT statememt. A far superior and accurate method than to go data dictionary hunting to determine just which column could be in a result set.

  • 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/

  • Need help populating dynamically-created fields

    I have a form which uses Javascript to create table rows on
    the fly so as to add items to a list dynamically. The table
    consists of two fields -- an ID and let's call the other one
    Attribute A. The user clicks "Add another one" and another row of
    data entry fields pops up. My action page works fine to get the
    value of these rows using the evaluate() function (I always
    wondered what that did), but I want it to go back to the calling
    page, have the calling page create the correct number of rows, and
    populate them with the changed or inserted data that was just saved
    -- the same way that an ordinary action page might save data and
    then return you to the calling page.
    The first row of this table is created through HTML and only
    additional rows are created dynamically.
    I have it all working up to and including the creation of the
    correct number of fields as an "onload=(loadTheData)" in the
    <body> tag, but how the heck and where do I populate them
    with the data returned from the query?
    Below is the Javascript and how it's called. I changed some
    variable names to protect the innocent, but that's basically how it
    works. So the Javascript is creating the fields -- one for each
    record returned by the query -- but how can I assign the record
    values in turn? Do I need WDDX? If so, how would that be
    written?

    If you are going to use JavaScript to dynamically create the
    list, then
    look into the <cfwddx...> tag that is very useful for
    translating
    ColdFusion data structures into JavaScript data structures.
    You can
    then use the JavaScript data to populate your table.
    But I would think it would be simplier to use the ColdFusion
    data to
    build the default table with existing data. Instead of just
    creating
    one row with ColdFusion create rows for the existing data
    then just use
    the JavaScript to add more rows on the client, just as you
    are doing now.
    P.S. evaluate() is usually an awkward choice to access
    dynamical form
    variables. I presume you are using something like
    <cfset something = evaluate("form.aField_#aVar#")>
    This can be easier with the use of array notation.
    <cfset something = form['aField_' & aVar]>
    OR
    <cfset something = form['aField_#aVar#']>
    To each his own, but knowing array notation is a very
    powerful technique.

  • Evaluating dynamically generatedform  field names

    On form submission I need to find out if check boxes exist
    and have values. The field names are generated dynamically &
    there could be many. Here's the code I've been messing with. I am
    able to find out it the field has a value if it exists, but I can't
    figure out how to combine this with isDefined("") to test for the
    field's existence and avoid the "field i not defined in form"
    errors.
    <cfloop index="a" from="1" to="#form.numRows#">
    <cfset thisname = "form." & #a# & "_Clear">
    <!--- how do I use isDefined("") at this point to avoid
    an error on the next line when the field does not exist? --->
    <cfset thisVal= Evaluate("form.#thisname#")>
    <cfoutput> #thisname# #thisVal# </cfoutput>
    </cfloop>
    Thanks in advance for any help!

    run a loop over your field names like: <cfloop index="x"
    list="#form.fieldnames#"> then you have all of your form field
    names that are defined.

  • XSLT for dynamic target field names

    Hello,
    I got a requiremt where I need to create target field names from input values.
    Input XML -
    <?xml version="1.0" encoding="UTF-8"?>
    <Createelement_MT>
    <Field Name="A">
    <Value>1</Value>
    </Field>
    <Field Name="B">
    <Value>1</Value>
    </Field>
    </Createelement_MT>
    Expected OutPut XML -
    <?xml version="1.0" encoding="UTF-8"?>
    <Createelement_MT>
    <Statement><TableName><table>XYZ</table>
    <access>
    <A> 1 </A>
    <B> 2 </B>
    </access>
    </Statement></TableName>
    </Createelement_MT>
    The value of the attribute 'Name' of field 'Field' should be the name of target field.
    XSLT:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml"/>
    <xsl:template match="@*|node()">
    <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
    </xsl:template>
    <xsl:template match="Createelement_MT">
    <xsl:element name="statement">
    <xsl:element name="TableName">
    <xsl:element name="table">ABC</xsl:element>
    <xsl:element name="access">
    <xsl:for-each select="Field">
    <xsl:element name="{@Name}">
    <xsl:value-of select="Value"></xsl:value-of></xsl:element></xsl:for-each>
    </xsl:element>
    </xsl:element>
    </xsl:element>
    </xsl:template>
    </xsl:stylesheet>
    Error:
    Error: at xsl:element on line 15 of file:///......: XTDE0820: Invalid element name. Invalid QName {}
    Please help me with the xslt code for this requirement.
    Thanks!

    Hi,
                Please try this code
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:output method="xml"/>
         <xsl:template match="/">
              <Createelement_MT>
                   <Statement>
                        <TableName>
                             <table>XYZ</table>
                        <access>
                             <xsl:for-each select="Createelement_MT/Field">
                                  <xsl:variable name="field" select="@Name"></xsl:variable>
                                  <xsl:element name="{$field}">
                                  <xsl:value-of select="Value"></xsl:value-of>
                                  </xsl:element>
                             </xsl:for-each>
                        </access>
                        </TableName>
                   </Statement>
              </Createelement_MT>
         </xsl:template>
    </xsl:stylesheet>
    input xml
    <?xml version="1.0" encoding="UTF-8" ?>
    - <Createelement_MT>
    - <Field Name="A">
      <Value>1</Value>
      </Field>
    - <Field Name="B">
      <Value>1</Value>
      </Field>
      </Createelement_MT>
    output xml
    <?xml version="1.0" encoding="UTF-8" ?>
    - <Createelement_MT>
    - <Statement>
    - <TableName>
      <table>XYZ</table>
    - <access>
      <A>1</A>
      <B>1</B>
      </access>
      </TableName>
      </Statement>
      </Createelement_MT>
    One small request, if you think your question has been answered,could you please kindly, if possible, close this thread.
    regards
    Anupam

  • Dynamically creating variable names in javascript

    Hi.
    I have to create variable names dynamically in JavaScript.
    My JSP file accesses information from Database and forms a String corresponding to the information received.
    This String is passed to a JAvaScript function that should CREATE a variable with that NAME.
    For Ex:
    My database access resulted in a single row...
    id name sal
    34 John Smith 38000
    the resulting VARIABLE NAME should be Menu34. 34 comes from the database result.
    Is there any function to dynamically create a variable name in JavaScript?
    Thanks in advance.

    The JSP is printing the contents of an HTML page, and Javascript code can be part of that output...
    So you would just write out the stuff, something like this....
    <script>
    <% while(rs.hasNext()) { %>
    var Menu<%= rs.getInt("id") %> = '<%= rs.getString("name") %>';
    <% } %>
    </script>
    In the browser, it'll just look like another long list of Javascript variables.

  • Diferent key field names within a recordset

    Hi
    Can we have different key field names for records within a recordset.
    When i give different key field names for Header and detail records in a recordset i get the error below: -
    message not processed: com.sap.aii.messaging.adapter.trans.TransformException: Transformer Conversion3.0.5227 Error initializing Class: java.lang.Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found (4408) Parameter 'xml.keyFieldName' is missing (4403) ; nested exception caused by: java.lang.Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found (4408) Parameter 'xml.keyFieldName' is missing (4403)
    Thanks

    Hello Pratihchi,
                   One keyfield name is allowed, eventhough we have different records per recordset. Because we can differentiate the rows based on the keyfieldvalue and those value we need to mention in the fieldname. Check below link which contains the example on this.
    https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/5393- [original link is broken] [original link is broken]> [original link is broken] File Adapter->Sender File Adapter for Content Conversion
    Regards.
    Prasanna.

  • Creating field name programmatically

    HI,
    I am trying to create a Note field programmatically. I have used the below code:
    string fieldtestComments = list.Fields.Add("InserttesterAdjustersCommentsHere", SPFieldType.Note, false);
    list.Fields[fieldtestComments].Update();
    However, the field name is only taking till "InserttesterAdjustersCommentsHer". Only 32 characters are getting taken. However, I am able to create the same column from UI as "InserttesterAdjustersCommentsHere".
    How to fix this?
    Thanks

    Hi,    
    There will be a length limit in field internal name convention which is 32, even from UI, the limit is still there.
    When we create a column from UI, what we will input in the “Column name” text box is the display name of this field, its internal name will be truncated automatically
    if there are more than 32 characters.
    To find the internal name a field, you can go to “List Settings” page, in the “Columns” group, click a column name and redirect to
    the “Edit Column” page, there, you will find the internal name of a field at the end of the URL in the address bar like “xxx$Field=internal name here”.
    So it is better to set up a field name short and meaningful.
    Best regards
    Patrick Liang
    TechNet Community Support

  • Setfocus to dynamic created field

    Hello
    In a field validation for a dynamic created table row the focus should be set to the same field again, if the field entry is invalid.
    I tried the following two versions for the field 'MyNumber' in the first row without success:
    >javascript:
    >1) xfa.host.setFocus("MySubform.Table1.DataRow.all.item(0).MyNumber");
    >2) xfa.host.setFocus("MySubform.Table1.DataRow[0].MyNumber");
    Thank you for any hint.
    Sincerely
    Lore

    Hello SekharN
    Yes, this is exactly what I wanted to do. But the focus wasn't set back to the wrong-entry-field. No focus was set at all :(
    I used the exit event was this wrong?
    Here my code:
    if(!XCode.isNull && XCode.rawValue != '') {
    var s = XCode.rawValue;
    var tridigits = new RegExp('^\\d{3}');
    if (tridigits.test(s) == false){
    xfa.host.messageBox( "Please 3 digits!" );
    xfa.host.setFocus(this.somExpression);
    Thank you
    Sincerely
    Lore

  • Display Technical Field Names within a Transaction Screen

    Hi All,
    Someone once showed me how to do this and for the life of me I cannot figure out how to do it in ECC 6.0.
    I would like to display the technical field names of all fields in a transaction.  It is important to note that I am not looking for the <b>F1...Technical Details</b> solution.  I am well aware that the technical field name can be retrieved by this method.  I am really looking to see all the technical names of the fields in a particular transaction without a lot of clicking and searching.
    When I saw this before you could quickly change from technical field names to short field names and vise versa. 
    I know this could also be accomplished in SE11 or SE16 - but that is not exactly what I am looking for.
    Can anyone help??

    Hi Christopher,
    you know that Rollin Stones thing?
    You can't always get what you want.
    There is no such functionality for standard transactions.
    Regards,
    Clemens

  • Dynamic Form field name

    I have a shopping cart that creates a dynamic field for the
    quantity of each product in the cart. I need to be able to make
    sure the user does not submit a blank value. I can not use cfinput
    as per client instructions. The field is:
    <input name="Quant_#GetCart.ShowID#" type="Text"
    value="#GetCart.Quantity#" size="1" maxlength="2"
    title="Quantity"/>
    How would you go about validating Quant_#GetCart.ShowID#?
    Thanks in advance for the help/suggestions.

    LeftCorner,
    Thanks for the compliments, and for analyzing my code. It's
    cool to see you care. I agree that the find() should have been
    findNoCase(), and the inclusion of a trim() could be a good one,
    however, the evaluating is not better. In general, Evaluate() is
    becoming less used, and is being certainly phased out where it's
    not extremely necessary. There are a few arguments as to why,
    performance being one of them, readability being another. I stand
    by my code and I recommend you check out structure notation
    (structure[key] when you would normally write structure.key except
    you don't know what "key" really is) wherever possible.

Maybe you are looking for

  • Image quality in shared photostream

    Hello, I started to use iCloud photo library which works fine and I have all the photos in iCloud in original quality (at least at seems like so to me). But when I start a shared photostream and put the photos there and I open it on my Mac in new app

  • Mac mini ram error

    I have an intel mac mini originally with 512mb ram and wanted to increase to 2gb, i purchased crucials ram, and since have a blank gray screen with a flashing icon of a folder with a "?" any ideas? I have reopened it up to check everything is ok, and

  • I just reloaded my computer how do get my music back

    i just completely reloaded my computer how do i restore my purchased music to my library

  • Where can i download Photoshop CS5

    I know photoshop CS 6 is out. But my company doesn't have CS6, It has CS5 but they lost the disks or never had any or something, Maybe they used the downloads when they where available, But they have serials for CS5 and I can't buy CS6 ! I've been lo

  • Cannot connect to the Instance

    Hi there, I'm a newbie to Oracle. I downloaded Oracle 9i Database. After installation, when I try to connect to the Instance using command prompt, I get the following error message: SQL> CONNECT SYS/change_on_install AS SYSDBA ERROR: ORA-12560: TNS:p