Skip to main content
1-Visitor
November 29, 2019
Solved

How to get Segment ID of a table?

  • November 29, 2019
  • 1 reply
  • 2978 views

Hello all,

I have a situation where I want to save table in CSV format.
I am using 'ProDwgtableSave' API for the same.

ProError ProDwgtableSave(ProDwgtable* table, ProPath path, ProDwgtableFormattype table_format, int segment_id );

 

The API extern 'ProDwgtableSave' requires 'segment id' as an argument.

 

I am using 'ProDwgtableSegCount' API to get segment count.

 

ProError ProDwgtableSegCount (ProDwgtable *p_table,
int *n_segs);

 

But I am not finding a way to get 'segment id' from the number of segments.

Therefore I am not able to save CSV file as it is not getting specific table data.
Though I am able to save TXT file as it does not require 'segment id' as argument.

 

Thanks in advance.

 

Regards,
Pratik Chougule

Best answer by Eike_Hauptmann

Hi Pratik

 

int segments;

if (ProDwgtableSegCount(table, &segments) == PRO_TK_NO_ERROR) {
if (ProDwgtableSegSheetGet(table, 0, &segsheet) != PRO_TK_NO_ERROR) {
ProDwgtableSegSheetGet(table, -1, &segsheet);
segments = -1;
}
else {
segments = 0;
}

}

 

If you have a multisegment table 0 is the first segment. If you have a single segment table -1 could also be the segment. So sometimes you need the 0 sometimes the -1. Just make a encapsulated call and try both.

 

Br,

Eike

 

 

1 reply

17-Peridot
November 29, 2019

Hello,

Maybe it is ordinal number of a segment?

If you have several segments in table, then try to put 0, 1, ... in function as segment id

15-Moonstone
December 2, 2019

Hi Pratik

 

int segments;

if (ProDwgtableSegCount(table, &segments) == PRO_TK_NO_ERROR) {
if (ProDwgtableSegSheetGet(table, 0, &segsheet) != PRO_TK_NO_ERROR) {
ProDwgtableSegSheetGet(table, -1, &segsheet);
segments = -1;
}
else {
segments = 0;
}

}

 

If you have a multisegment table 0 is the first segment. If you have a single segment table -1 could also be the segment. So sometimes you need the 0 sometimes the -1. Just make a encapsulated call and try both.

 

Br,

Eike

 

 

1-Visitor
December 2, 2019

Yes, Eike Hauptmann, it worked with 0 value.
👍

 

 

Regards,
Pratik