Insert delimiters

Hi,
I tried to insert Pipe-Delimiters at positions in text file, but i get this error, please some can help sort it.
$path ="c:\bkps\sample.txt"
$Positions=@(2,9,16,32)
$dat = Get-Content $path
$Positions | foreach {$dat
$dat=$dat.Insert($_,'|')
$dat > $path
Method invocation failed because [System.Object[]] doesn't contain a method named 'Insert'.
At line:5 char:17
+ $dat=$dat.Insert <<<< ($_,'|')
+ CategoryInfo : InvalidOperation: (Insert:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound

Brian's code has a very important subtlety; note that it uses the positions in descending order.  That way you haven't moved the target for the earlier positions as you modify the string. If you were to take his code and do the inner For loop in the
"natural" ascending order, you'd wind up with this output instead:
12|345678|901234|567890123456789|012345678901234567890
The first pipe is in the right spot, then the second one is off by one, the third is off by two, and so on.
Another way to approach that is to reverse the positions array and then do a normal iteration:
$string = "12345678901234567890123456789012345678901234567890"
$Positions=@(2,9,16,32)
[array]::Reverse($Positions)
$Positions | foreach {$string = $string.Insert($_,'|')}
$string
12|3456789|0123456|7890123456789012|345678901234567890
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

Similar Messages

  • Header with delimiters

    I'm creating a XML-output file. As usual, there are no delimiters between the tags. So the file is not readable with a simple textviewer (like notepad). But one of our customers needs this
    delimiters to process the XML.
    I had introduced indent="yes" in the xsl:output node of xslt file. This seems to have worked for the output file. But a header will be added to the output file through a message
    assignment shape in the orchestration. I would the indent to be applicable to the header of the output file too.
    Is there any parameter or work around to insert delimiters (crlf) to the header of the output XML-file?

    The following is the sample output file. Individual jobs are indented through xslt. Need header bit to be indented as well.
    <message><header userid="" date="08/01/2014"><schema version="1" name="New" /><source productversion="" product="" system="" /><destination productversion=""
    product="" system="" /></header><body><jobs><job action="" contract="65" client_ref="4162213" description="OUT OF HOURS - no hot water " job_type="ELECR" required_date="03/12/2013
    00:00">
      <job_lines>
        <job_line line_no="1" line_type="WE" code="Z04" description="OUT OF HOURS - TOTAL LOSS OF ELECTRICAL HEATING 1ST NOV TO 30TH APR" quantity="1">
        </job_line>
      </job_lines>
      <job_property ref="72121095" alt_ref="43558" name="44-49 Floor 7 FLAT 44                                  
    " short_name="44-49 Floor 7 FLAT 44                          " house_no="44 " street="Grantham Towers"
    address_line_1="44-49 Floor 7 FLAT 44 " tenant="Mr S Tsegaye">
      </job_property>
      <job_notes>
      </job_notes>
      <job_lines>
        <job_line line_no="1" line_type="XE" code="Z04" description="OUT OF HOURS - TOTAL LOSS OF Power failure 1ST NOV TO 30TH APR" quantity="1">
        </job_line>
      </job_lines>
      <job_property ref="72121096" alt_ref="43565" name="89 Floor 17 FLAT 34                                  
    " short_name="89 Floor 17 FLAT 34                          " house_no="89 " street="Grantham Towers"
    address_line_1="89 Floor 17 FLAT 34 " tenant="Mr S Tsegaye">
      </job_property>
      <job_notes>
      </job_notes>
      </job></jobs></body></message>
    The expected output is as follows
    <message>
     <header userid="" date="20/12/13">
      <schema version="1" name="new" />
      <source productversion="" product="" system="" />
      <destination productversion="" product="" system=""/>
     </header>
     <body>
      <jobs>
       <job action="" .............

  • BULK INSERT from a text (.csv) file - read only specific columns.

    I am using Microsoft SQL 2005, I need to do a BULK INSERT from a .csv I just downloaded from paypal.  I can't edit some of the columns that are given in the report.  I am trying to load specific columns from the file.
    bulk insert Orders
    FROM 'C:\Users\*******\Desktop\DownloadURL123.csv'
       WITH
                  FIELDTERMINATOR = ',',
                    FIRSTROW = 2,
                    ROWTERMINATOR = '\n'
    So where would I state what column names (from row #1 on the .csv file) would be used into what specific column in the table.
    I saw this on one of the sites which seemed to guide me towards the answer, but I failed.. here you go, it might help you:
    FORMATFILE [ = 'format_file_path' ]
    Specifies the full path of a format file. A format file describes the data file that contains stored responses created using the bcp utility on the same table or view. The format file should be used in cases in which:
    The data file contains greater or fewer columns than the table or view.
    The columns are in a different order.
    The column delimiters vary.
    There are other changes in the data format. Format files are usually created by using the bcp utility and modified with a text editor as needed. For more information, see bcp Utility.

    Date, Time, Time Zone, Name, Type, Status, Currency, Gross, Fee, Net, From Email Address, To Email Address, Transaction ID, Item Title, Item ID, Buyer ID, Item URL, Closing Date, Reference Txn ID, Receipt ID,
    "04/22/07", "12:00:21", "PDT", "Test", "Payment Received", "Cleared", "USD", "321", "2.32", "3213', "[email protected]", "[email protected]", "", "testing", "392302", "jdal32", "http://ddd.com", "04/22/03", "", "",
    "04/22/07", "12:00:21", "PDT", "Test", "Payment Received", "Cleared", "USD", "321", "2.32", "3213', "[email protected]", "[email protected]", "", "testing", "392932930302", "jejsl32", "http://ddd.com", "04/22/03", "", "",
    Do you need more than 2 rows? I did not include all the columns from the actual csv file but most of it, I am planning on taking to the first table these specfic columns: date, to email address, transaction ID, item title, item ID, buyer ID, item URL.
    The other table, I don't have any values from here because I did not list them, but if you do this for me I could probably figure the other table out.
    Thank you very much.

  • How to insert a date in a numbers cell from applescript?

    Hey guys,
    I was just wondering, I got this list of dates that i want to change with this handler that i call datachanger, i use it to seperate dates like these 1994-11-07 and reassemble them. Now what i would like to do is to reassemble them in such a way that i can insert every item in datalist in numbers cells. Now it gives me a weird error. How do i have to change the things between bas3 and bas2 to get it to fit in a numbers cell without an error? or do i have to use the quoted form of it before i can insert it?
    SCRIpt
    on datumchanger(datumlist)
        set a to 1
        set datalist to {}
        repeat with bas in datumlist
            set AppleScript's text item delimiters to "-"
            set bas1 to text item 1 of bas
            set bas2 to text item 2 of bas
            set bas3 to text item 3 of bas
            set datumitem1 to bas3 & "," & bas2 & "," & bas1
            set the end of datalist to datumitem1
        end repeat
        return datalist
    end datumchanger
    SCRIPT
    Help is so much appreciated:)
    Thank you so much in advance:)

    As I carefully wrote in several scripts posted here, when we want to insert a date in a Numbers cell,
    we must coerce it to a string.
    --{code}
    set date1 to "" & 1 & "-" & 1 & "-" & 2012 -- it's a string
    set date2 to "" & 1 & "/" & 1 & "/" & 2012 -- it's a string
    set date3 to current date -- it's a date
    set date4 to "1994-11-07"
    Here is the safe way to build a date which will behave well on every localized version.
    I use the short date string to set the time component to 00:00:00 *)
    set date5 to date (short date string of (current date))
    set year of date5 to 1943
    set month of date5 to 12
    set day of date5 to 31
    tell application "Numbers" to tell document 1 to tell sheet 1 to tell table 1
              set value of cell "B2" to date1
              set value of cell "C2" to date2
              set value of cell "D2" to date3 as text
              set value of cell "E2" to date4
              set value of cell "F2" to date5 as text
    end tell
    --{code}
    On my machine the format yyyy-mm-dd is accepted but I don't remember if it's the standard behavior or if I added this format in the dedicated resource file.
    Yvan KOENIG (VALLAURIS, France) lundi 30 janvier 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My Box account  is : http://www.box.com/s/00qnssoyeq2xvc22ra4k

  • A function to insert SQL which creates insert SQL

    I realise this is a bit recursive, but my users are a demanding lot! We want to store in a table the instruction to check if AUDIT_SYS_OPERATIONS is TRUE and to store the result of that check in some sort of an audit table.
    In other words, the basic SQL you'd run directly might be:
    select case when value='TRUE' then 1 else 0 end as passfail
    from v$parameter where upper(name)='AUDIT_SYS_OPERATIONS';But we want to convert this into something which will generate an INSERT statement and which itself can be inserted into a table full of these sorts of audit checks:
    insert into myaudit_checks values ('select ''insert into myaudit_table values (''||case when value=''TRUE'' then 1 else 0 end ||'');'' as passfail
    from v$parameter where upper(name)=''AUDIT_SYS_OPERATIONS'';');I find the rules for doing this to be quite easy:
    1. Add 'insert into myaudit_test values ('|| before the original CASE keyword
    2. Add ||');' before the original 'AS PASSFAIL' keywords
    3. Wrap the whole lot in single quotes
    4. Double up any quotes inside those new ones
    5. Wrap the new statement inside a standard INSERT statement.
    My users don't think that's easy, though. So I thought I'd write them a function which would return the double-quoted insert statement when fed the non-quoted basic select. It works OK, on the whole, except that calling it involves... doubling up the quotes. That is:
    select create_insert_stmt('select case when value=''TRUE'' then 1 else 0 end as passfail
    from v$parameter where upper(name)=''AUDIT_SYS_OPERATIONS'';') from dual;...works OK, but the parameter being passed to the CREATE_INSERT function requires the 'TRUE' and 'AUDIT_SYS_OPERATIONS' strings to be double-single-quoted up-front, which defeats the purpose a bit. I want them to be able to feed the completely original select statement, with single-quoted strings, into the function... but, syntactically, this looks impossible.
    Anyone got any ideas on how to spit out the final 'select 'insert...'' given the original, single-quoted select statement, without requiring too much from my users by way of thought or effort?
    The only thing I thought of was to have them store the original select in a text file and read it via UTL_FILE... but if anyone's got any better ideas, I'd be pleased to hear them.

    >
    Anyone got any ideas on how to spit out the final 'select 'insert...'' given the original, single-quoted select statement, without requiring too much from my users by way of thought or effort?
    >
    For anything that might include quotes use alternative quoting. See Text Literals in the SQL Language doc
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/sql_elements003.htm
    >
    In the bottom branch of the syntax:
    •Q or q indicates that the alternative quoting mechanism will be used. This mechanism allows a wide range of delimiters for the text string.
    •The outermost ' ' are two single quotation marks that precede and follow, respectively, the opening and closing quote_delimiter.
    •c is any member of the user's character set. You can include quotation marks (") in the text literal made up of c characters. You can also include the quote_delimiter, as long as it is not immediately followed by a single quotation mark.
    •quote_delimiter is any single- or multibyte character except space, tab, and return. The quote_delimiter can be a single quotation mark. However, if the quote_delimiter appears in the text literal itself, ensure that it is not immediately followed by a single quotation mark.
    If the opening quote_delimiter is one of [, {, <, or (, then the closing quote_delimiter must be the corresponding ], }, >, or ). In all other cases, the opening and closing quote_delimiter must be the same character.
    Here are some valid text literals:
    'Hello'
    'ORACLE.dbs'
    'Jackie''s raincoat'
    '09-MAR-98'
    N'nchar literal'
    Here are some valid text literals using the alternative quoting mechanism:
    q'!name LIKE '%DBMS_%%'!'
    q'<'So,' she said, 'It's finished.'>'
    q'{SELECT * FROM employees WHERE last_name = 'Smith';}'
    nq'ï Ÿ1234 ï'
    q'"name like '['"'
    {quote}

  • To insert single quote in a varchar2 field

    hi guys,
    i am facing a simple problem, can any one of you help me in this regard. the problem is i am unable to insert a single quote in a varchar2 field like
    SQL> DESC EMP
    Name Null? Type
    EMPNO NOT NULL NUMBER(4)
    ENAME VARCHAR2(10)
    JOB VARCHAR2(9)
    MGR NUMBER(4)
    HIREDATE DATE
    SAL NUMBER(7,2)
    COMM NUMBER(7,2)
    DEPTNO NUMBER(2)
    SQL> INSERT INTO EMP (EMPNO, ENAME) VALUES (100, 'Mc'Aure') ;
    ERROR:
    ORA-01756: quoted string not properly terminated
    oracle takes ' as the delimiters for identifying the word. in my case the name itself contains a single quote which is to be inserted. how to insert the single quote
    i want to insert it from asp coding and also from sql plus 8.0.
    advanced thanks
    ananth

    If you use a ' in a varchar2, it must be marked with a second '.
    In your case:
    SQL> INSERT INTO EMP (EMPNO, ENAME) VALUES
    (100, 'Mc''Aure') ;
    null

  • Insert Excel information to Access Table, cf error

    I am trying to create a file upload that will allow me to use a .csv file, to insert the data into an access database. I have the code written, but right now, it's giving me an error and I can't figure out what I'm doing wrong, this is my first time doing this, so any and all help would be greatly appreciated.
    This is my code to read the .csv file.:
    <cftry>
    <cffile action="DELETE" file="#FORM.attachment_1#"/>
    <cfcatch>
    <!--- File delete error. --->
    </cfcatch>
    </cftry>
    <cfelse>
    <!--- no errors with the file upload so lets upload it--->
    <cffile action="upload"
                     filefield="attachment_1"
                     result="myResult"
                     accept = ""
                     destination="f:\websites\211562Fe3\uploads\"
                     nameconflict="Makeunique">
    <cfset svrFile = "#myResult.ServerDirectory#"&"\"&"#myResult.ServerFile#"/>
    <!--- get and read the CSV-TXT file --->
    <cffile action="read" file="#svrFile#" variable="csvfile">
    <!--- loop through the CSV-TXT file on line breaks and insert into database --->
    <cfloop index="index" list="#csvfile#" delimiters="#chr(10)##chr(13)#">
        <cfquery name="importcsv" datasource="#APPLICATION.dataSource#">
             INSERT INTO employees (siteID,empstatus,empfirstname,empmiddlename,emplastname,empnickname,emplocation,empgende r,empdob,empdoh,empee)
             VALUES
                      ('#listgetAt('#index#',1, ',')#',
                       '#listgetAt('#index#',2, ',')#',
                       '#listgetAt('#index#',3, ',')#',
                       '#listgetAt('#index#',4, ',')#',
                       '#listgetAt('#index#',5, ',')#',
                       '#listgetAt('#index#',6, ',')#',
                       '#listgetAt('#index#',7, ',')#',
                       '#listgetAt('#index#',8, ',')#',
                       '#listgetAt('#index#',9, ',')#',
                       '#listgetAt('#index#',10, ',')#',
                       '#listgetAt('#index#',11, ',')#'
       </cfquery>
    </cfloop>
    <cffile action="DELETE" file="#svrFile#"/>
    <!--- use a simple database query to check the results of the import - dumping query to screen --->
    <cfquery name="rscsvdemo" datasource="#APPLICATION.dataSource#">
             SELECT * FROM csvdemo
    </cfquery>
    <cfdump var="#employees#">
    </cfif>
    The error is in the insert query, I have all my columns named the same ad the database table and in the same order, I also formatted each cell in the .csv to be the same as the database.
    This is the error:
    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC  Microsoft Access Driver] Data type mismatch in criteria expression.
    The error occurred in  C:\websites\211562fe3\partners\cfm\csvUploadAction.cfm: line 60
    58 :                    '#listgetAt('#index#',9, ',')#',
    59 :                    '#listgetAt('#index#',10, ',')#',
    60 :                    '#listgetAt('#index#',11, ',')#' 
    61 :                   )
    62 :    </cfquery>
    Thank you

    I changed my code a little.. now I get an error about converting a date.. so I must be on the right track.... Can you help me straiten this out?
    This is my "new" code:
    <cftry>
    <cffile action="DELETE" file="#FORM.attachment_1#"/>
    <cfcatch>
    <!--- File delete error. --->
    </cfcatch>
    </cftry>
    <cfelse>
    <!--- no errors with the file upload so lets upload it--->
    <cffile action="upload"
                     filefield="attachment_1"
                     result="myResult"
                     accept = ""
                     destination="c:\websites\211562Fe3\uploads\"
                     nameconflict="Makeunique">
    <cfset svrFile = "#myResult.ServerDirectory#"&"\"&"#myResult.ServerFile#"/>
    <!--- get and read the CSV-TXT file --->
    <cffile action="read" file="#svrFile#" variable="csvfile">
    <!--- loop through the CSV-TXT file on line breaks and insert into database --->
    <cfloop index="i" list="#csvfile#" delimiters="#chr(10)##chr(13)#">
        <cfquery name="importcsv" datasource="#APPLICATION.dataSource#">
             INSERT INTO employees (siteID,empstatus,empfirstname,empmiddlename,emplastname,empnickname,emplocation,empgende r,empdob,empdoh,empee)
             VALUES
                      (<CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#trim(listgetAt(i,1))#">,
                        <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#listgetAt(i,2)#">,
                        <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#listgetAt(i,3)#">,
                     <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#trim(listgetAt(i,4))#">,
                     <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#listgetAt(i,5)#">,
                     <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#listgetAt(i,6)#">,
                     <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#listgetAt(i,7)#">,
                     <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#listgetAt(i,8)#">,
                     <CFQUERYPARAM CFSQLTYPE="CF_SQL_DATE" VALUE="#listgetAt(i,9)#">,
                     <CFQUERYPARAM CFSQLTYPE="CF_SQL_DATE" VALUE="#listgetAt(i,9)#">,
                     <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#listgetAt(i,9)#">
       </cfquery>
    </cfloop>
    <cffile action="DELETE" file="#svrFile#"/>
    <!--- use a simple database query to check the results of the import - dumping query to screen --->
    <cfquery name="rscsvdemo" datasource="#APPLICATION.dataSource#">
             SELECT * FROM employees
    </cfquery>
    <cfdump var="#employees#">
    </cfif>
    I'm not sure it's totally correct.. but the error is different!
    This is the error:
    The cause of this output exception was that:  coldfusion.runtime.Cast$DateStringConversionException: The value empdob  cannot be converted to a date..
    The error occurred inf :\websites\211562fe3\partners\cfm\csvUploadAction.cfm: line 58
    56 :                  <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar"  VALUE="#listgetAt(i,7)#">,
    57 :                  <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar"  VALUE="#listgetAt(i,8)#">,
    58 :                  <CFQUERYPARAM CFSQLTYPE="CF_SQL_DATE"  VALUE="#listgetAt(i,9)#">,
    59 :                  <CFQUERYPARAM CFSQLTYPE="CF_SQL_DATE"  VALUE="#listgetAt(i,9)#">,
    60 :                  <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar"  VALUE="#listgetAt(i,9)#">
    Also I can make my .csv file available for you if you need it. Also, the date is being inseted in this format: 3/3/1952

  • CS3: typography and end nested style delimiters

    Hello,
    I'm trying to trick InDesign into exporting INX files in which all nested style delimiters are marked by an ENS character (a processing instruction in the exported INX). This makes the transform to XML much easier, because you can group adjacent, like-styled text without actually processing that text to find instances of character delimiters.
    I've written a JavaScript to process a layout, inserting an ENS character at every instance of any non-ENS delimiter (as defined in the paragraph style). The problem is that this seems to affect the layout in unanticipated ways.
    All seems well -- the nested character styles are properly applied, and InDesign seems to be paying attention to the required character delimiters and ignoring the inserted ENS characters. Mostly.
    In some cases, the ENS characters affect the typography of a paragraph. They seem to adjust applied kerning. The flow of text adjusts slightly at the insertion of the ENS character.
    I'd much appreciate any input on how InDesign handles ENS characters, especially when they aren't called for by the nested style definition.
    Thanks,
    Andrea

    Hi Dave,
    Thanks for your speedy reply.
    There are enough instances of nested styles that we're trying to avoid explicit ENS characters at all cost. There will be so many of them to enter!
    So ENS characters affect the resolution of nested styles even when they aren't used as delimiters in the nested style definitions? Is InDesign essentially looking for either the declared delimiter *or* an ENS character?
    If so, is there any way that can be overridden?
    Thanks,
    Andrea

  • Applescript and insert names without extension (Mail)

    Hi,
    my script does the following when i drop a video file on this app:
    1. transcode it to ogg
    2. copy the name and insert it in a newly created mail in the Subject and Message with "NameOfFile"
    It is nearly perfect but it copies the file extension in the new mail, too.
    How do i get the app to insert only the name without the Extension??
    Best Regards
    Lysard
    on open of droppedFiles
              tell application "Finder"
                        set NameOfFile to name of item (item 1 of droppedFiles as alias)
              end tell
              repeat with nextDroppedFile in droppedFiles
                        set videoname to POSIX path of nextDroppedFile
                        if videoname contains "." then
                                  set oldDelims to AppleScript's text item delimiters
                                  set AppleScript's text item delimiters to {"."}
                                  set videooutput to text 1 thru text item -2 of videoname
                                  set AppleScript's text item delimiters to oldDelims
                        end if
                        set SettingPfad to POSIX path of (path to me)
                        tell application "Terminal"
                                  do script ("ffmpeg2theora " & quoted form of videoname & " -f 30 -x 720 -y404 -V1500 -A 128 --two-pass -o " & quoted form of videooutput & "_XYZ.ogv")
                        end tell
                        tell application "Mail"
                                  set theSubject to "Anlieferung " & NameOfFile & " _XXX"
                                  set theContent to "Hallo,
    " & NameOfFile & " ist availible here:
    xxx
    BR
    ME"
                                  set theAddress to "[email protected]"
                                  set theSignatureName to "Signatur 1"
                                  set msg to make new outgoing message with properties {sender:"[email protected]", subject:theSubject, content:theContent, visible:true}
                                  tell msg to make new to recipient at end of every to recipient with properties {address:theAddress}
      --tell msg to make new attachment with properties {file name:theAttachmentFile as alias}
                                  set message signature of msg to signature theSignatureName
                        end tell
              end repeat
    end open

    There are a couple of points in your original script that should be addressed.
    One you are dropping files on the script and sending them out as mail messages but because you are setting the filename before you actually loop through the dropped files all mail messages will have the same filename. You should move
    tell application "Finder"
                        set NameOfFile to name of item (item 1 of droppedFiles as alias)
              end tell
    Inside the repeat to get the actual filename in each mail message.
    Then this
    if videoname contains "." then
                 set oldDelims to AppleScript's text item delimiters
                 set AppleScript's text item delimiters to {"."}
                 set videooutput to text 1 thru text item -2 of videoname
                 set AppleScript's text item delimiters to oldDelims
    end if
    While it works is defeating the whole point of setting the text item delimiter.
    Once you do
    set AppleScript's text item delimiters to {"."}
    then text item 1 of videoname is the filename and text item 2 is the extension ie:
    set videooutput to text item 1 of videoname
    will get the name of the file into videooutput
    In fact you could just use videooutput as the name in the mail message.
    regards

  • Insert Fields From INSPECTOR DOCUMENT INFO into Pages Document

    I was able to do this since the DOS version of MS Word and would be rather surprised if there is no way to do it in Pages. Is there a way to insert "Document Info" about the present document into the present document?
    Am trying to work up my own template for manuscripts. I use the Document Info dialog and would like to have information like Author and Title dropped into the document via a field like can be done with Page Numbers.

    Bingo.
    I built a script inserting the infos extracted from the Infos dialog.
    --[SCRIPT insertdocumentinfos]
    Enregistrer le script en tant que Script ou Application : insertdocumentinfos.xxx
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Utilisateurs:<votreCompte>:Bibliothèque:Scripts:Applications:Pages:
    Il vous faudra peut-être créer le dossier Pages et peut-être même le dossier Applications.
    Définir dans un document Pages le point d’insertion des infos sur le document.
    Aller au menu Scripts , choisir Pages puis choisir “insertdocumentinfos”
    Le script extrait les infos de l’inspecteur Document > Infos et les insère dans le document.
    --=====
    L’aide du Finder explique:
    L’Utilitaire AppleScript permet d’activer le Menu des scripts :
    Ouvrez l’Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case “Afficher le menu des scripts dans la barre de menus”.
    Sous 10.6.x,
    aller dans le panneau “Général” du dialogue Préférences de l’Éditeur Applescript
    puis cocher la case “Afficher le menu des scripts dans la barre des menus”.
    --=====
    Save the script as a Script or an Application : insertdocumentinfos.xxx
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Pages:
    Maybe you would have to create the folder Pages and even the folder Applications by yourself.
    Define, in a Pages document, the insertion point for the document's infos.
    Go to the Scripts Menu, choose Pages, then choose “insertdocumentinfos”
    The script extract the infos from IOnspector > Document > Infos and insert them in the document.
    --=====
    The Finder’s Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the “Show Script Menu in menu bar” checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2011/03/09
    --=====
    property Document_loc : missing value
    --=====
    on run
    run script doyourduty
    end run
    --=====
    script doyourduty
    local inspecteur_actif, mon_auteur, mon_titre, mesmotsclef, mes_commentaires, mes_infos, selection_originelle
    my activateGUIscripting()
    Grab the localized title of the Document's inspector *)
    tell application "Pages" to set Document_loc to localized string "Document"
    tell application "Pages" to tell document 1
    -- set focus on the document
    end tell
    Grabs the title of the active inspector *)
    set inspecteur_actif to my getactiveinspector()
    if inspecteur_actif is {} then
    No inspector open, trigger Show Inspector to open one *)
    my selectMenu("Pages", 8, 15)
    Grabs its title *)
    set inspecteur_actif to my getactiveinspector()
    end if
    repeat
    if inspecteur_actif contains Document_loc then
    exit repeat
    else
    Open a new Inspector *)
    my selectMenu("Pages", 8, 16)
    Grabs its title *)
    set inspecteur_actif to my getactiveinspector()
    end if
    end repeat
    Now the Document Inspector is open, extract the infos
    set {mon_auteur, mon_titre, mesmotsclef, mes_commentaires} to my get_infos()
    set mes_infos to my recolle({mon_auteur, mon_titre, mesmotsclef, mes_commentaires}, tab)
    Insert the infos at the selection point
    tell application "Pages" to tell document 1
    set selection_originelle to contents of the selection
    set selection to (selection_originelle & mes_infos)
    end tell
    Clear the property because I dislike to store such item in the script *)
    set Document_loc to missing value
    end script
    --=====
    on recolle(l, d)
    local oTIDs, t
    set oTIDs to AppleScript's text item delimiters
    set AppleScript's text item delimiters to d
    set t to l as text
    set AppleScript's text item delimiters to oTIDs
    return t
    end recolle
    --=====
    on activateGUIscripting()
    (* to be sure than GUI scripting will be active *)
    tell application "System Events"
    if not (UI elements enabled) then set (UI elements enabled) to true
    end tell
    end activateGUIscripting
    --=====
    on getactiveinspector()
    local the_inspector
    tell application "Pages" to activate
    tell application "System Events" to tell application process "Pages"
    set the_inspector to title of every window whose subrole is "AXFloatingWindow"
    end tell
    return the_inspector
    end getactiveinspector
    --=====
    on get_infos()
    local l_auteur, le_titre, mots_clef, les_commentaires
    tell application "Pages" to activate
    tell application "System Events" to tell application process "Pages"
    tell (first UI element whose role is "AXTabGroup") of first group of (first window where subrole is "AXFloatingWindow" and title is Document_loc)
    tell (third UI element whose role is "AXRadioButton") to if value is 0 then click
    set {l_auteur, le_titre, mots_clef, les_commentaires} to value of every text field
    end tell
    end tell
    return {l_auteur, le_titre, mots_clef, les_commentaires}
    end get_infos
    --=====
    my selectMenu("Pages",5, 12)
    ==== Uses GUIscripting ====
    on selectMenu(theApp, mt, mi)
    tell application theApp
    activate
    tell application "System Events" to tell process theApp to tell menu bar 1 to ¬
    tell menu bar item mt to tell menu 1 to click menu item mi
    end tell -- application theApp
    end selectMenu
    --=====
    --[/SCRIPT]
    Yvan KOENIG (VALLAURIS, France) mercredi 9 mars 2011 22:14:43

  • How to tell between update and insert ?

    I have a form where a user can enter a value, press a button and anoher input would appear, add another value, press the button again, etc. When done, he submits and I use cfloop list to insert the data into a table.
    When I bring up this form again, I check to see if there are any values in the table. If they are there, I display the values in a table, one per row.  At the end, I have the button again, just in case they need to add more values.
    Here is the problem that I am running into and do not know how to solve. How do I know whether they added a new value, or simply changed one of the existing values ? Or what is they did both, change an exisitng value and add a new value ?
    This is the code I use if they chagned an exisitng value :
    <cfloop index="dateCodeID" list="#form.dateCodeID#" delimiters=",">
    <cfquery name="qryUpdateDateCodes" datasource="db">
    udate table
         set dateCode = '#Evaluate("form.dateCode#dateCodeID#")#'
        where stockScreenID = '#form.stockScreenID#'
    and dateCodeID = '#dateCodeID#'
    </cfquery>
    </cfloop>
    and I would use the cfloop list to insert a new value, but how would I know which one to use when they submit ? I do not know whether an exisitng value(s) changed or new value(s) added.
    Thanks

    So if I have three existing values displayed, and add a new one, would I first loop thru the insert to check for the three existing records, and then insert the new record if no insert is performed ?
    You would loop and call the stored procedure once for each record to be handled.  The stored procedure contains the logic to handle the insert or update determined by whether or not a record with the matching primary key value exists in your table. Some databases have built in functionality to handle insert or update logic for you.  Microsoft SQL Server 2008 has MERGE ( http://msdn.microsoft.com/en-us/library/bb510625.aspx ) and MySQL has INSERT ON DUPLICATE KEY UPDATE ( http://dev.mysql.com/doc/refman/6.0/en/insert-on-duplicate.html ).
    Is the statement IF ( COUNT_OF_RECORDS_UPDATED = 0 ) the actual statement to check for udpated records ? 
    Yes, this statment is used to determine if the previous statement updated any records in the database.  The exact syntax will depend on your database server version.
    What if I update only one of the three existing records, and also add a new record ?
    I'm not sure I follow you.  Perhaps if you could post your ColdFusion and SQL code we could offer better responses.  You might also post a SQL specific question in a forum for your database version.

  • How to insert a value into a table

    I have an ordering system. It displays all the orders by
    customer ID. If an order is complete, a check number is entered for
    the corresponding line item, otherwise it is left blank.
    My code uses the following code to display the form. All are
    display fields only, except for the last one, where the check
    number can be entered.
    <cfoutput query="qryDetail" group="partNumber">
    <tr>
    <td valign="top" class="TitleText"
    align="center">#lineItem#</td>
    <td valign="top" class="TitleText"
    align="center">#OrderNumber#</td>
    <td valign="top" class="TitleText"
    align="center">#partNumber#</td>
    <td valign="top" class="TitleText"
    align="center">#dollarformat(qryDetail.unitValue)#</td>
    <td valign="top" class="TitleText" align="center">
    <cfinput type="text" name="checkNumber#keyID#">
    <input type="hidden" name="keyID"
    value="#qryDetail.keyID#">
    </td>
    I use something like the following to update the table with
    the check numbers entered.
    <cfloop index="KeyID" list="#form.KeyID#"
    delimiters=",">
    <cfquery name="qryUpdate" datasource="dbName">
    update tblChecks
    set checkNumber = '#Evaluate("form.checkNumber#KeyID#")#'
    where custID = '#form.custID#'
    and KeyID = '#KeyID#'
    </cfquery>
    </cfloop>
    Now we have another table that will contain the customer
    order history. If the check number was entered for a particular
    line item, I need to insert that line item nubmer into this table,
    along with some other columns. I tried to use the same loop, then
    other loops, but cannot seem to get this to work. Seems simple
    enough, but I obvisouly am missing something.
    How would I insert the line item number (only if a check
    number was entered for that line item) into the table ?

    Here is the code with the queries commented out :
    <cfloop list="#form.fieldnames#" index="field">
    <cfif left(field, 11) is "checkNumber" AND
    len(trim(form[field]))>
    <cfset keyID = listlast(field, '_')>
    <cfset lineItem = listgetat(field, 2, '_')>
    <cfset checknum = form[field]>
    <!---cfquery name="qryUpdate" datasource="dbName">
    UPDATE tblChecks
    SET checkNumber = '#checknum#'
    WHERE custID = #form.custID#
    AND KeyID = #keyid#
    </cfquery--->
    <cfoutput> loop is
    field: <b>#field#</b><br>
    checknum: #checknum#<br>
    lineitem: #lineitem#<br>
    keyID: #keyID#<br>
    </cfoutput>
    <cfelse>
    <cfoutput>Else is
    field: <b>#field#</b><br>
    form[field]: #form[field]#<br>
    len: #len(trim(form[field]))#<br>
    </cfoutput><cfabort>
    </cfif>
    </cfloop>
    This is the output. If I do not put in cfabort, the code just
    drops thru and I never see any output display, so I use cfabort to
    stop so I can see the output.
    loop is field: CHECKNUMBER_11_218
    CHECKNum: xxxxxxxxxxxxxxxxxxxx
    lineitem: 11
    keyID: 218
    Else is field: CHECKNUMBER_1_24
    form[field]:
    I entered the x's into checknum for line item 11, so that is
    correct.
    I then took out the comments from the update query and tried
    it again and it updated for line item 11 (you were right, I had to
    take out the single quotes in the query). I then removed the
    commets for the insert query and it did not insert. I tried the
    whole thing again and tried to add to line item 10 and it dropped
    straight to the else part, displaying :
    Else is field: CHECKNUMBER_1_24
    form[field]:
    len: 0
    So it seems the if statement if failing the second time thru
    the loop :
    <cfif left(field, 11) is "checkNumber" AND
    len(trim(form[field]))>
    This is my input statement :
    <cfinput type="text"
    name="checkNumber_#lineItem#_#keyID#">
    I am really confused now. It seems to work the first time
    thru the loop, then the second time it fails.

  • Insert Picture with formula?

    Hello,
    Is it possible to have a picture automatically appear when the user types an associated description?
    Here is an example:
    I have a picture of a product. I want that picture to appear in a specific spot when I type in the number "16." I also need the product's list price to appear in a specific cell also.
    How can I do this?

    It's done.
    Here is the script.
    --[SCRIPT billwithpicture]
    Enregistrer le script en tant que Script : billwithpicture.scpt
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
    Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
    Sélectionner la cellule où vous souhaitez insérer un code objet.
    aller au menu Scripts , choisir Numbers puis choisir billwithpicture
    Le script vous demandera de saisir le code (ici ce doit être un nombre entier)
    Il extrait le prix et la photo de l'objet correspondant de la table "lookup"
    et insère ces informations dans les cellules requises.
    Le nom de la table et les colonnes prix et photos sont définis
    par trois properties que vous pouvez éditer.
    --=====
    L'aide du Finder explique:
    L'Utilitaire AppleScript permet d'activer le Menu des scripts :
    Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications:AppleScript.
    Cochez la case "Afficher le menu des scripts dans la barre de menus".
    Sous 10.6.x,
    aller dans le panneau "Général" du dialogue Préférences de l'Éditeur Applescript
    puis cocher la case "Afficher le menu des scripts dans la barre des menus".
    --=====
    Save the script as a Script: billwithpicture.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    Select the cell in which you want to insert an object code.
    go to the Scripts Menu, choose Numbers, then choose "billwithpicture"
    The script will ask you to enter the object code (here it must be an integer)
    From the table "lookup", it extract the price and the picture of the selected object
    then it insert these values in the defined cells.
    The table name as well as the target columns are defined
    by three properties which you may edit.
    --=====
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications:AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    --=====
    Yvan KOENIG (VALLAURIS, France)
    2010/04/08
    --=====
    property table_source : "lookup"
    property colonne_prix : 3
    property colonne_image : 5
    property valeurs_numeriques : {}
    --=====
    on run
    my activateGUIscripting()
    my nettoie()
    set {dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()
    tell application "Numbers" to tell document dName
    if not (exists table "lookup" of sheet sName) then
    if my parleAnglais() then
    error "The table “" & table_source & "” is unavailable in the sheet “" & sName & "” of the spreadsheet “" & dName & "” !"
    else
    error "La table « " & table_source & " » n’existe pas dans la feuille « " & sName & " » du tableur « " & dName & " » !"
    end if -- parleAnglais
    end if -- not exists…
    end tell
    if my parleAnglais() then
    set Prompt to "Insert an integer item code"
    else
    set Prompt to "Saisir le code d'un objet (nombre entier)"
    end if
    set le_code to my askAnumber(Prompt, 3, "i")
    tell application "Numbers" to tell document dName to tell sheet sName to tell table table_source
    set derniere_ligne to count row
    set my valeurs_numeriques to value of cells 1 thru 2 of rows 1 thru derniere_ligne
    set le_prix to 0.0
    repeat with r from 1 to derniere_ligne
    try
    Useful if the first row is a header with text content
    set maybe to (item 1 of item r of my valeurs_numeriques) as integer
    on error
    set maybe to 0
    end try
    if maybe = le_code then
    set le_prix to item 2 of item r of my valeurs_numeriques
    set selection range to cell r of column 3
    exit repeat
    end if
    end repeat -- with r
    if le_prix is 0.0 then
    my nettoie()
    if my parleAnglais() then
    error "There is no object whose code is “" & le_code & "” !"
    else
    error "Aucun objet ne porte le code « " & le_code & " » !"
    end if
    end if -- le_prix is 0.0…
    end tell -- "Numbers"…
    my raccourci("Numbers", "c", "ca") -- Copy Style
    tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
    tell row rowNum1
    set value of cell colNum1 to le_code
    set value of cell colonne_prix to le_prix
    end tell -- row rownum1
    set selection range to (cell rowNum1 of column colonne_image)
    end tell -- "Numbers"…
    my raccourci("Numbers", "v", "ca") -- Paste Style
    my nettoie()
    end run
    --=====
    on nettoie()
    set my valeurs_numeriques to {}
    end nettoie
    --=====
    set {rowNum1, colNum1, rowNum2, colNum2} to my getCellsAddresses(dname,s_name,t_name,arange)
    on getCellsAddresses(d_Name, s_Name, t_Name, r_Name)
    local two_Names, row_Num1, col_Num1, row_Num2, col_Num2
    tell application "Numbers"
    set d_Name to name of document d_Name (* useful if we passed a number *)
    tell document d_Name
    set s_Name to name of sheet s_Name (* useful if we passed a number *)
    tell sheet s_Name
    set t_Name to name of table t_Name (* useful if we passed a number *)
    end tell -- sheet
    end tell -- document
    end tell -- Numbers
    if r_Name contains ":" then
    set two_Names to my decoupe(r_Name, ":")
    set {row_Num1, col_Num1} to my decipher(d_Name, s_Name, t_Name, item 1 of two_Names)
    if item 2 of two_Names = item 1 of two_Names then
    set {row_Num2, col_Num2} to {row_Num1, col_Num1}
    else
    set {row_Num2, col_Num2} to my decipher(d_Name, s_Name, t_Name, item 2 of two_Names)
    end if
    else
    set {row_Num1, col_Num1} to my decipher(d_Name, s_Name, t_Name, r_Name)
    set {row_Num2, col_Num2} to {row_Num1, col_Num1}
    end if -- r_Name contains…
    return {row_Num1, col_Num1, row_Num2, col_Num2}
    end getCellsAddresses
    --=====
    set { dName, sName, tName, rname, rowNum1, colNum1, rowNum2, colNum2} to my getSelParams()
    on getSelParams()
    local r_Name, t_Name, s_Name, d_Name
    set {d_Name, s_Name, t_Name, r_Name} to my getSelection()
    if r_Name is missing value then
    if my parleAnglais() then
    error "No selected cells"
    else
    error "Il n'y a pas de cellule sélectionnée !"
    end if
    end if
    return {d_Name, s_Name, t_Name, r_Name} & my getCellsAddresses(d_Name, s_Name, t_Name, r_Name)
    end getSelParams
    --=====
    set {rowNumber, columnNumber} to my decipher(docName,sheetName,tableName,cellRef)
    apply to named row or named column !
    on decipher(d, s, t, n)
    tell application "Numbers" to tell document d to tell sheet s to tell table t to ¬
    return {address of row of cell n, address of column of cell n}
    end decipher
    --=====
    set { d_Name, s_Name, t_Name, r_Name} to my getSelection()
    on getSelection()
    local _, theRange, theTable, theSheet, theDoc, errMsg, errNum
    tell application "Numbers" to tell document 1
    repeat with i from 1 to the count of sheets
    tell sheet i
    set x to the count of tables
    if x > 0 then
    repeat with y from 1 to x
    try
    (selection range of table y) as text
    on error errMsg number errNum
    set {_, theRange, _, theTable, _, theSheet, _, theDoc} to my decoupe(errMsg, quote)
    return {theDoc, theSheet, theTable, theRange}
    end try
    end repeat -- y
    end if -- x>0
    end tell -- sheet
    end repeat -- i
    end tell -- document
    return {missing value, missing value, missing value, missing value}
    end getSelection
    --=====
    on parleAnglais()
    local z
    try
    tell application "Numbers" to set z to localized string "Cancel"
    on error
    set z to "Cancel"
    end try
    return (z is not "Annuler")
    end parleAnglais
    --=====
    on decoupe(t, d)
    local oTIDs, l
    set oTIDs to AppleScript's text item delimiters
    set AppleScript's text item delimiters to d
    set l to text items of t
    set AppleScript's text item delimiters to oTIDs
    return l
    end decoupe
    --=====
    Asks for an entry and checks that it is an floating number
    set myInteger to my askAnumber(Prompt, DefaultValue, "i")
    set myFloating to my askAnumber(Prompt, DefaultValue, "f")
    on askAnumber(lPrompt, lDefault, IorF)
    local lPrompt, lDefault, n
    tell application (path to frontmost application as string)
    if IorF is in {"F", "f"} then
    set n to text returned of (display dialog lPrompt & " (" & (1.2 as text) & ")" default answer lDefault as text)
    try
    set n to n as number (* try to convert the value as an number *)
    return n
    on error
    if my parleAnglais() then
    display alert "The value needs to be a floating number." & return & "Please try again."
    else
    display alert "La valeur saisie doit être un nombre décimal." & return & "Veuillez recommencer."
    end if
    end try
    else
    set n to text returned of (display dialog lPrompt default answer lDefault as text)
    try
    set n to n as integer (* try to convert the value as an integer *)
    return n
    on error
    if my parleAnglais() then
    display alert "The value needs to be an integer." & return & "Please try again."
    else
    display alert "La valeur saisie doit être un nombre entier." & return & "Veuillez recommencer."
    end if
    end try -- 1st attempt
    end if -- IorF…
    end tell -- application
    Here if the first entry was not of the wanted class
    second attempt *)
    tell application (path to frontmost application as string)
    if IorF is in {"F", "f"} then
    set n to text returned of (display dialog lPrompt & " (" & (1.2 as text) & ")" default answer lDefault as text)
    try
    set n to n as number (* try to convert the value as an number *)
    return n
    on error
    end try
    else
    set n to text returned of (display dialog lPrompt default answer lDefault as text)
    try
    set n to n as integer (* try to convert the value as an integer *)
    return n
    on error
    end try -- 1st attempt
    end if -- IorF…
    end tell -- application
    if my parleAnglais() then
    error "The value you entered was not numerical !" & return & "Goodbye !"
    else
    error "La valeur saisie n’est pas numérique !" & return & "Au revoir !"
    end if
    end askAnumber
    --=====
    on activateGUIscripting()
    (* to be sure than GUI scripting will be active *)
    tell application "System Events"
    if not (UI elements enabled) then set (UI elements enabled) to true
    end tell
    end activateGUIscripting
    --=====
    ==== Uses GUIscripting ====
    This handler may be used to 'type' text, invisible characters if the third parameter is an empty string.
    It may be used to 'type' keyboard raccourcis if the third parameter describe the required modifier keys.
    I changed its name « shortcut » to « raccourci » to get rid of a name conflict in Smile.
    on raccourci(a, t, d)
    local k
    tell application a to activate
    tell application "System Events" to tell application process a
    set frontmost to true
    try
    t * 1
    if d is "" then
    key code t
    else if d is "c" then
    key code t using {command down}
    else if d is "a" then
    key code t using {option down}
    else if d is "k" then
    key code t using {control down}
    else if d is "s" then
    key code t using {shift down}
    else if d is in {"ac", "ca"} then
    key code t using {command down, option down}
    else if d is in {"as", "sa"} then
    key code t using {shift down, option down}
    else if d is in {"sc", "cs"} then
    key code t using {command down, shift down}
    else if d is in {"kc", "ck"} then
    key code t using {command down, control down}
    else if d is in {"ks", "sk"} then
    key code t using {shift down, control down}
    else if (d contains "c") and (d contains "s") and d contains "k" then
    key code t using {command down, shift down, control down}
    else if (d contains "c") and (d contains "s") and d contains "a" then
    key code t using {command down, shift down, option down}
    end if
    on error
    repeat with k in t
    if d is "" then
    keystroke (k as text)
    else if d is "c" then
    keystroke (k as text) using {command down}
    else if d is "a" then
    keystroke k using {option down}
    else if d is "k" then
    keystroke (k as text) using {control down}
    else if d is "s" then
    keystroke k using {shift down}
    else if d is in {"ac", "ca"} then
    keystroke (k as text) using {command down, option down}
    else if d is in {"as", "sa"} then
    keystroke (k as text) using {shift down, option down}
    else if d is in {"sc", "cs"} then
    keystroke (k as text) using {command down, shift down}
    else if d is in {"kc", "ck"} then
    keystroke (k as text) using {command down, control down}
    else if d is in {"ks", "sk"} then
    keystroke (k as text) using {shift down, control down}
    else if (d contains "c") and (d contains "s") and d contains "k" then
    keystroke (k as text) using {command down, shift down, control down}
    else if (d contains "c") and (d contains "s") and d contains "a" then
    keystroke (k as text) using {command down, shift down, option down}
    end if
    end repeat
    end try
    end tell
    end raccourci
    --=====
    --[/SCRIPT]
    Yvan KOENIG (VALLAURIS, France) samedi 31 juillet 2010 12:15:02

  • Insert into Flat File with no data

    Hello,
    One of my client is encountering a problem in loading data from oracle table to a Flat File.
    We are using a IKM SQL to File.
    A staging area different from Target and defined on the source Logical Schema.
    and options Genreate Header and Insert rows.
    The problem is :
    At the end of the interface execution, which finish without error we see in the file, the header correctly generated which let me think that there's no permission problem with the file.
    But there is no records...
    And I don't know why ???
    There is the .bad and .error files but they are empty.
    The file datastore seems to be well declared with the good delimiters....
    We are using the Sunopsis Driver File :
    com.sunopsis.jdbc.driver.FileDriver
    jdbc:snps:file
    Cause the file are not accepted with the new one ...
    Note that all our interfaces which are reading flat file work fine.
    But there's no one writting in which work.
    If somebody ever had this problem, or just have an idea about this let me know please.
    Cordially,
    BM

    "Bonjour",
    I usually use the snpsoutfile API to unload data into flat file.
    It's not the exact solution at your question, but i's a technical solution.

  • Dynamic Insert Help Please

    quote:
    <cfoutput query="stand">
    <tr bgcolor="#IIf(CurrentRow Mod 2, DE('ffffff'),
    DE('cccccc'))#">
    <td>
    <select name="score_identifierscore"
    id="score_identifierscore">
    <option value="0" selected>0</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    </select>
    <input name="score_identifier" type="hidden"
    id="score_identifier" value="#stand.ident_name#">
    <input name="score_teacherid" type="hidden"
    id="score_teacherid" value="#session.pstid#">
    <input name="score_studentid" type="hidden"
    id="score_studentid" value="#url.stid#">
    <input name="score_vid" type="hidden" id="score_vid"
    value="#url.vid#">
    <input name="score_staid" type="hidden" id="score_staid"
    value="#url.staid#">
    <input name="score_studentname" type="hidden"
    value="#studentname.first_name# #studentname.last_name#">
    </td>
    <td><div
    align="center">#stand.ident_name#</div></td>
    <td> #stand.ident_description#</td>
    </tr>
    </cfoutput>
    Start off by saying I work for a school corp, so my knowledge
    is limited to what I've taught myself and any help will be
    appreciated.
    Alright, here's what I have. I'm dynamically creating a list
    of standards and for each standard I want to submit a score chosen
    by the teacher and the identifier along with some other
    information. My problem is that on the insert I can't figure out
    how to match score with identifier. I can't possibly create a field
    in the table for every identifier, so I need to take the list and
    insert it into another table with score_identifer and
    score_identifierscore and so on....the above way is not workign for
    me.
    How can I get this accomplished, I can usually work off of
    examples, so please examples or any help please? If you have a
    better way, I'm up for it, because this way isn't working.
    Thanks in advance...

    quote:
    Originally posted by:
    AlwaysWannaLearn
    What does the INSERT statement look like?
    Why can't you create a table with columns names as: PK,
    score_identifierscore, score_identifier, score_teacherid,
    score_studentid, score_vid, score_staid, score_studentname this way
    you can also map any of these fields against other tables to create
    a more robust query result set?
    Almost exactly the way I have it setup. Small snippet of the
    dynamically generate html code that the user inputs. The problem is
    in my insert statement:
    <tr bgcolor="ffffff">
    <td>
    <select name="score_identifierscore"
    id="score_identifierscore">
    <option value="0" selected>0</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    </select>
    <input name="score_identifier" type="hidden"
    id="score_identifier" value="F1.17.1 ">
    </td>
    <td><div align="center">F1.17.1
    </div></td>
    <td> Estimate and secure necessary supplies
    </td>
    </tr>
    <tr bgcolor="cccccc">
    <td>
    <select name="score_identifierscore"
    id="score_identifierscore">
    <option value="0" selected>0</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    </select>
    <input name="score_identifier" type="hidden"
    id="score_identifier" value="F1.17.2">
    </td>
    <td><div align="center">F1.17.2
    </div></td>
    <td> Determine plants, shrubs, and tree
    locations
    </td>
    </tr>
    <input name="score_teacherid" type="hidden"
    id="score_teacherid" value="#session.pstid#">
    <input name="score_studentid" type="hidden"
    id="score_studentid" value="#url.stid#">
    <input name="score_vid" type="hidden" id="score_vid"
    value="#url.vid#">
    <input name="score_staid" type="hidden" id="score_staid"
    value="#url.staid#">
    <input name="score_studentname" type="hidden"
    value="#studentname.first_name# #studentname.last_name#">
    Here's my insert statement, but now that I've look at it,
    that won't match the identifier with the score, so it's crap. Any
    help is appreciated. Thanks
    <cfloop index="I" list="#form.score_identifier#"
    delimiters=",">
    <cfquery datasource="whatever">
    INSERT INTO voc_scores
    (score_studentid, score_vid, score_staid, score_identifier,
    score_teacherid, score_studentname,score_identifierscore)
    VALUES('#FORM.score_studentid#','#FORM.score_vid#','#FORM.score_staid#','#I#','#FORM.score _teacherid#','#FORM.score_studentname#',
    '#FORM.score_identifierscore#')
    </cfquery>
    </cfloop>

Maybe you are looking for