Author Topic: Save data to file?  (Read 2435 times)

Jokew

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Save data to file?
« on: July 07, 2015, 04:37:48 pm »
Hi,

I'll just lay out the whole problem (since there might be more than one solution to this one  :) )

I have a JScript that counts the connectors to every element in a diagram and then changes the color of the elements dependent on how many connectors it has to it (think heatmap). Now my problem is that it takes so much time to update the appearance of an element (right now 120 elements and there will be more).

I was thinking that I can save the number of connectors that an element has to a file (i.e write to file). And then the script can just update the ones that have been changed instead of all of them. So i basically need to read and write to a file.

Kind regards
Jokew

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10527
  • Karma: +358/-31
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Save data to file?
« Reply #1 on: July 07, 2015, 05:00:14 pm »
You have to look for the right libraries to use.
It might be easier with VBScript.

If you can't find the proper libraries for Jscript then you can even use the ones from VBScript and call them from JScript.

There an example like that in for the input box in the examples that are shipped with EA.

Geert

Jokew

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Save data to file?
« Reply #2 on: July 07, 2015, 05:44:12 pm »
Thank you!

I guess it was a rather easy solve actually. But I posted partly cause I hadn't had my coffee yet and partly cause someone might have had a better approach than me (like if you could update all the appearances at once instead of one by one).

Anyhow this read/write solution works fine for now, thx :)

Andreas Morgenstern

  • EA User
  • **
  • Posts: 26
  • Karma: +1/-0
    • View Profile
Re: Save data to file?
« Reply #3 on: July 25, 2017, 03:11:20 am »
Hi,

sorry for coming back to this old topic, but I'm facing exactly the same problem:
how to write to a file from JScript (or even better: Javascript) from within EA scripting.
A small code snippet how to achieve that would be really great.

Andreas

qwerty

  • EA Guru
  • *****
  • Posts: 11472
  • Karma: +305/-263
  • I'm no guru at all
    • View Profile
Re: Save data to file?
« Reply #4 on: July 25, 2017, 07:20:36 am »
Doesn't the CSV-Export script in the EAScriptlib do exactly that?

q.