Book a Demo

Author Topic: Model Search. Truncated text if value is over 255  (Read 6062 times)

novikovigor

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Model Search. Truncated text if value is over 255
« on: July 10, 2013, 04:55:48 pm »
Hello again.
There is another problem.
In model search I get notes from t_attribute and t_attributetag by SQL. Then I copy result set (select all => copy selected to clipboard) and paste it into text editor (then I open it as CSV).
But I have a problem: if text value in fields is too big it is truncated. How can I get notes from t_attribute and t_attributetag without truncating?

I find out if in database cell's value is over 255, in result set it is truncated.
« Last Edit: July 10, 2013, 06:51:41 pm by novikovigor »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Model Search. Truncated text if value is over
« Reply #1 on: July 10, 2013, 07:11:53 pm »
Report a bug.

Consider writing a script to achieve correct results.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Model Search. Truncated text if value is over
« Reply #2 on: July 10, 2013, 09:38:10 pm »
If I'm not mistaken EADocx also exports data in excel.
You could try that.

Geert

novikovigor

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Model Search. Truncated text if value is over
« Reply #3 on: July 10, 2013, 09:46:01 pm »
I know, Geert, and I did.
But now I must organize export by SQL, it's not my decision.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Model Search. Truncated text if value is over
« Reply #4 on: July 10, 2013, 09:57:19 pm »
In that case I would write a script/addin to export the data you need.
It's really not that difficult to write to an excel file.

Just create a two dimensional array containing the data you need (which you can find using Repository.SQLQuery) and the pass that array to an operation such as:

Code: [Select]
       /// <summary>
        /// write the contents to the excel sheet starting at the given row
        /// </summary>
        /// <param name="contents">the context to write</param>
        /// <param name="beginrow">the row to start from</param>
        public void write(object[,] contents, int beginrow)
        {
            //get the exact range where the contents should be placed
            Range targetRange = sheet.get_Range(sheet.Cells[beginrow, 1], sheet.Cells[contents.GetUpperBound(0)+1 + beginrow-1, contents.GetUpperBound(1)+1]);
            targetRange.Value2 = contents;
        }

This is super fast.

Geert

novikovigor

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Model Search. Truncated text if value is over
« Reply #5 on: July 11, 2013, 12:25:44 am »
Thank you, Geert, for your advice! I read articles in your blog, but all the same it would not be simple (time is runnung out).
I decide to resolve problem next way...
Using mid('string', i+255, 255) I store left-substrings into 10 different columns (it will be with reserve), then write a simple parser on java (my language), that merges in CSV these columns in one.
It will be the fastest way to resolve our problem.

Nevertheless, thanks to everybody!
« Last Edit: July 11, 2013, 12:26:22 am by novikovigor »