cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

API for Import from spreadsheet and BOM extraction code.

V_B_THAKARE
6-Contributor

API for Import from spreadsheet and BOM extraction code.

Hi @HelesicPetr,

Can you please help me into below queries:

Question 1 : Is there any API for Import from spreadsheet.

Question 2 : Anyone know about BOM extract report code so that we can use similar to create a BOM.

9 REPLIES 9

Hi @V_B_THAKARE 

1. No the dedicated API does not exist, You need to write own code to do so. Read the excel and create or update the parts in the system. 

2. what exactly you need? create multilevel bom by own code and write the results to your excel file ? Yes it is possible. 

 

for excel manipulation I use org.apache.poi.xssf.usermodel.package for xlsx XSSFWorkbook.class 

 

PetrH

Hello @HelesicPetr

 

I want "Import from spreadsheet" option in Project container.

Currently this functionality is limited to Product and Library.

 

If we can't extend existing "Import from spreadsheet" functionality to project container.

 

Then we need to create custom action with Validator class so that the custom action will be visible only in Project container.

And then need to create class file with help of that we import spreadsheet within Project container.

 

So for that I need API or code which, I can use in my class file logic.

Hi @V_B_THAKARE 

You don't understand. There is no general api for import from spreadsheet.

It is covered by Wizard Processor import from spreadsheet that works only with Product and Library. That is limitation of the function.

 

If you would use same function in the project, just remove the OOTB validator. But I'm sure it can not work that way. 

 

PS> just additional point of my experience: it is less time consuming to write own import function then to investigate how the OOTB function works and ho to rewrite it.

PetrH

Hi @HelesicPetr,

Sorry But, I am not aware of it. where I can find OOTB validator.

Hi @HelesicPetr@Hari_Vara & @Hari_Varadh 

 

If I run jcaDebug in Project container, I can see Import from spreadsheet option which is grayed out(see attached screenshot).

 

Question : Import from spreadsheet is grayed out in Project container, Is it due to ACL or OOTB validator?

 

V_B_THAKARE_0-1712305423217.png

 

Project Container_Import from spreadsheet_Grayed out.png

Hi,

I think its the OOTB behaviour for Projects.

What is your use case?

 

Cheers

Hari

@V_B_THAKARE 

OOTB validator checks the ACL. 

So it is based on validator. 

Also there are many validators for that function. 

PetrH

Hi @HelesicPetr & @Hari_Vara ,

1)Created custom action "Import from Spreadsheet".

 

<objecttype class="wt.part.WTPart" name="Spreadsheet">
<action name="ImportfromSpreadsheet" checkaccess="true" uicomponent="IMPORT_FROM_EXCEL">
<label>Import From Spreadsheet </label>
<command url="/netmarkets/jsp/ixb/importer/import.jsp" class="ext.com.XXX.ImportfromSpreadsheet.ImportFormProcessor" method="execute" windowType="popup"/>
</action>
</objecttype>

 

2)Created Java file and added OOTB code of "Import from Spreadsheet" into the Java file and just commented out

//if (!(var1.getActionOid().isA(PDMLinkProduct.class) | var1.getActionOid().isA(WTLibrary.class))) {

V_B_THAKARE_1-1712753541467.png

3)Now my custom action is visible in Project container.

.

Project Container_Import from spreadsheet_Custom Action.png

 

4)Whenever I click on my custom action "Import from Spreadsheet" then after uploading file, Validate spreadsheet option is not visible for me. 

V_B_THAKARE_2-1712753691263.png

 

5)Also added below entry into xconf file

 

<Service context="default" name="com.ptc.windchill.ixb.importer.jca.validator.ImportFromSpreadsheetActionValidator" targetFile="codebase/service.properties">
<Option serviceClass="ext.com.XXX.ImportfromSpreadsheet.ImportFormProcessor"
selector="ImportfromSpreadsheet"
requestor="null"
cardinality="duplicate"/>
</Service>

 

 

Any idea why it is happening.

Hi @V_B_THAKARE 

Because there is a validation if the wizard is correct one or something else that OOTB works but it does not work for your custom method.

As I said, In this situation It is easier to create own function then bending the OOTB function. 

PetrH

Announcements

Top Tags