Book a Demo

Author Topic: alter file extension during code generation  (Read 4799 times)

Kaneda

  • EA User
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
alter file extension during code generation
« on: July 27, 2005, 07:03:56 am »
Here we go again (sorry for using your board this heavily at the moment, but "My time frame is a little tight" would be the understatement of the century... ;) )

Can I alter the file extension?
I am creating a C# app, which is supposed to contain Crystal Reports (*.rpt).

I know that there is a file extension macro, but I am not quite sure where to use it.

I tried this cheap trick (for testing):

%if classStereotype == "struct"%

fileExtension = "rpt"
%endIf%

in the Class Base Template.

Well I guess, if it basically works, it gets overwritten by the default file ending I set in the C# code generation dialog?
There are 10 types of people in this world. Those who understand binaries and those who don't...

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: alter file extension during code generation
« Reply #1 on: July 27, 2005, 06:39:45 pm »
Well, you trick won't work because there is no property of a class that says what the file extension should be.  You won't be able to do this in the transform at all.

What I can suggest is that you select the right filename and extension when doing a generate.  (Generate the files one at a time initially to do this.)

After setting the filename it should be preserved and you can generate the whole package of classes at once if you wish.

Kaneda

  • EA User
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
Re: alter file extension during code generation
« Reply #2 on: July 28, 2005, 12:35:41 am »
well, I didn't realize that EA remembers the file (+ extension), though I have seen it often enough (smart move by myself ;) ).

However, I just realized that the whole idea was lacking any sense anyway. What good is a file with the proper extension, if EA can't create the right content for it?
I mean, I guess there is more to a CrystalReport file than just the extension :).

And to expect from any tool (esspecially at that price) to know the CR details, well, maybe from Rose XDE, which is 20 times as expensive (and 20 as big (file size) and 20 times as unusable without 3 months of proper training and therefore 20 times as annoying :) ) ...

Though a plugin of some sort would be nice. But that, I guess, would have to be provided vom CrystalDecisions, not from the CASE/MDA tool vendor....
There are 10 types of people in this world. Those who understand binaries and those who don't...

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: alter file extension during code generation
« Reply #3 on: July 28, 2005, 10:48:28 pm »
Well, that's where you could create a set of code generation templates too.  So you could generate it, just not synchronise with it.

Simon

talkea

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: alter file extension during code generation
« Reply #4 on: August 03, 2005, 01:19:02 am »
How can the file name/extension be 'preserved'?

I require to generate a set of ASPX pages and code behind files from a Web model that I have created in EA uysing the stereotypes 'asp page' and 'client page'.
The file extension proves to be a major stumbling block for easy generation.

What would be the easiset way to go about this?



Kaneda

  • EA User
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
Re: alter file extension during code generation
« Reply #5 on: August 03, 2005, 01:29:11 am »
select a single class, right click->generate.
In the dialog you need to specify the filename and extension. Whatever you enter here, should remain through following generations.
There are 10 types of people in this world. Those who understand binaries and those who don't...

talkea

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: alter file extension during code generation
« Reply #6 on: August 03, 2005, 01:40:41 am »
Going a bit further;
For the said purpose I have created a new language/product 'ASP.Net 2.0'.
Is there an option for specifying the file extension for a new product/language?

When I select 'ASP.Net 2.0' as the 'Target language' in the 'Generate Code(forward engineer)...' dialog box, what I get is a path like 'filepath\filename.aspx.cs.cs'... Can this be resolved?
Ideally, this step should be made intelligent ebough to provide a proper extension to the output file based on a language.

Thanks...

Kaneda

  • EA User
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
Re: alter file extension during code generation
« Reply #7 on: August 03, 2005, 02:03:07 am »
it would be great if for new languages a new specifications window would be added to the others under "Options".
Maybe, during language creation there could be a wizard of some sort so that certain properties for the language can be set (ie file extension, default attribute type etc...).

Though I don't know how much work that would include.
Would rise EAs value as an MDA tool though...
There are 10 types of people in this world. Those who understand binaries and those who don't...

talkea

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: alter file extension during code generation
« Reply #8 on: August 03, 2005, 03:09:59 am »
I agree...
On the face of it, it dosen't look like it would be all that difficult to implement this feature.

Anyways, I have put in a request for the same using the 'Request a Feature' facility.
Following is what the request looks like:
"
1. There should be a facility to specify/configure the file extension of any new product/language that is created via the 'Programming Languages DataTypes' dialog.
2. The extension of a file in the 'path' field in the 'Code Generate' dialog box should change ideally dynamically with a change in the target language.
"

Thank you for your time.