Blaise To ASCII - Adding a row of Field Names to the top of the ASCII file?

Please login to reply  Page: « < 1 of 1 > »
18 Aug 2010 - 18:21728
Blaise To ASCII - Adding a row of Field Names to the top of the ASCII file?

I just had a (relatively simple) request. It's something I've done a million times in the past with other software tools, but I've yet to try it in Blaise. Not sure if it's most easliy done in Manipula, or Cameleon, or ...

I've done Blaise-to-ASCII dumps before, creating data files both with and without comma-separated values.

For instance, using one of Fred's recent examples ...

{**********************************************************************
 Module   : MyQuestionnaire.BLA
 Overview :

    Sample questionnaire containing simple questions 

 Author   : fred.wensing@softscape.net.au

 Update History:
 Vsn   dd/mm/yyyy Person Change
 ----- ---------- ------ ------
 1.010 24/03/2009 Fred   -Initial version
**********************************************************************}

DATAMODEL MyQuestionnaire

FIELDS
    Name "What is your name?" / "Name" : STRING[20]
    Favourite "Which of these colours do you like the most?"
        / "Colour"
        : (Red, Green, Blue, Yellow, Purple, Black, Crimson)
    Activity "What is your main activity?"
        / "Activity"
        : (School (1) "Going to school"
          ,Working (2) "Working"
          ,HousKeep (5) "Housekeeping"
          ,Other (7) "Something else"
          )
RULES
    Name
    Favourite
    Activity
ENDMODEL 

I can create a file that looks like:

Sneezy,1,1
Sleepy,2,2
Dopey,3,5
Doc,4,7
Happy,5,1
Bashful,6,2
Grumpy,7,5

Or like ...

Sneezy11
Sleepy22
Dopey35
Doc47
Happy51
Bashful62
Grumpy75

But now I've been asked to create a file that looks like:

Name,Favourite,Activity
Sneezy,1,1
Sleepy,2,2
Dopey,3,5
Doc,4,7
Happy,5,1
Bashful,6,2
Grumpy,7,5

That is, a file whose first row consists of the Field Names, separated by commas, followed by the rows of data, whose values are also separated by commas.

Any thoughts, ideas, (or code) on how to do this in Blaise?



18 Aug 2010 - 18:36729

There is a setting for this in the OUTPUTFILE section in Manipula. It is called HEADERLINE. If you specify HEADERLINE=YES you get what you want. It is available in version 4.8 and higher.



18 Aug 2010 - 19:07730
Thanks!

Awesome! That's exactly what I was looking for.

Is this documented anywhere? I'm running Blaise v4.8, but my Developer's Guide is v4.5 and my Reference Manual is v4.1.

Is there v4.8 documentation available?



18 Aug 2010 - 19:17731
Online Assistant

Looks like I need to break my habit of looking at old PDFs and start looking at the 4.8 Online Assistant instead.



Please login to reply  Page: « < 1 of 1 > »