Write entire DME Query result to file without field definition?

 4 Replies
 0 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
ShawnV
Advanced Member
Posts: 37
Advanced Member
    Is there a way to write a DME Query result to a FileAccess node without writing it field by field.  For example, if I query the Employee table for Company, Employee, LastName, is there a way to write the 3 fields to the FileAccess node without defining them as query_Company, query_Employee, query_LastName?  It would be nice to just write out the entire line or the entire file like query_*

    Thanks for any help in advance.
    Shawn
    David Williams
    Veteran Member
    Posts: 1127
    Veteran Member
      The only shortcut I could find is to reference the data by record number and field number - Query9990_0_0 represents the first record and first field (zero = first to JavaScript). Query9990_0_1 represents the first record and second field, etc.
      David Williams
      ShawnV
      Advanced Member
      Posts: 37
      Advanced Member
        Thanks David.  That was the next path I was going down if I did not find an easier answer.
        Bob Canham
        Veteran Member
        Posts: 217
        Veteran Member
          can you use the outputData result from the query? I haven't tried it, but in other nodes, that seems to be the entire record. If you set the query string &OUT=csv&DELIM=, you should get a comma separated list and you could stick your file writer in the middle to append each line.
          jamesraceson
          Veteran Member
          Posts: 52
          Veteran Member
            Not to recreate the wheel (and depending on if the work justifies the value of the output), but you could also look at taking the result, parsing it out into an array (using regular expressions if necessary), then have whatever portion of the flow that you want to write the results loop through the array. You could also put in some data formating based on the contents of the array if desired. If it is just one off reporting (versus long term repetition), this might be more work than it's worth.