Jump to content

Export ONLY the datas which are in the report by SCRIPTING


---
 Share

Recommended Posts

Hello, 

I have a template with many many datas, inspections, etc.. and i run a script that "filter" some kind of inspection and updates some reports pages with only thoses results.

But at the end, i still need to export only the datas wihch are on the report and not the others, by scripting

Then, when I record a script, I can choose to view only the datas in report like :

drag and drop the whole report in the middle area.

gom.script.cad.show_element_exclusively (elements=gom.ElementSelection ({'category': ['key', 'elements', 'is_element_in_clipboard', 'False', 'explorer_category', 'reports']}))

but when i want to export then, it generate 

gom.script.table.export_table_contents (
	cell_separator=';', 
	codec='iso 8859-1', 
	decimal_separator='.', 
	elements=gom.ElementSelection ([gom.app.project.inspection[.............],gom.app.project.inspection[.............]])
	file='Overview.csv', 
	header_export=True, 
	...

with each element is mentionned one by one by is name.

 

but in the next project, the elements in the report are differrents.

 

Is it clear enough ?

 

Thanks for your help,

Best regards,

Julien

Edited
Link to comment
Share on other sites

You can replace the recorded "elements" parameter of "export_table_contents" by this:

# python style
elements = [element for element in gom.app.project.inspection if element.is_visible]

or this:

# GOM style
elements = gom.app.project.inspection.filter ('is_visible', True)

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...