Fusion Manage Forum
Welcome to Autodesk’s Fusion Manage (formerly Fusion 360 Manage) Forum. Share your knowledge, ask questions, and explore popular Fusion Manage topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Script for iterating through all items in a workspace

4 REPLIES 4
Reply
Message 1 of 5
sten
762 Views, 4 Replies

Script for iterating through all items in a workspace

I might be missing the obvious, but I can't find an example of how to iterate though all items in a workspace.

 

Can it be done?

 

Tags (1)
4 REPLIES 4
Message 2 of 5
DonovanJr
in reply to: sten

Sten,

 

Yes this can be done but you need to know all the dmsID's of all the records in the workspace.

 

I have accomplished this by using a second workspace that is simply a delimited list of the dmsID's for a given workspace and using that list to iterate through the records. The setup is as follows.

 

1. List Workspace (Basic with Workflow)

2. Item Details for List workspace has two field. list id & paragraph text field, that holds a delimited list of the dmsID's from your target workspace.

3. the Workflow is simply used to execute a script that needs to be run periodically by an Admin to remove from the list any dmsID with a status of deleted.

4. In your target workspace you need a script in the on create event to add the new dmsID to the list field in the list workspace.

 

Now when you want to iterate through a workspace you load the list workspace and use the delimited list to step through each record of your target workspace.

 

This method is clunky and may not be the best method and requires maintaining the list correctly, but does work (So far). I use this method to help with my autonumbering in my Items workspace to validate user inputs that I can't do simply with the standard autonumbering.I do have worries that I will run out of space in my list field (4000 characters) as the database grows. But hopefully a solution will present itself before than.

 

Hope this give you ideas.

 

Bob Donovan

 

 

 

Message 3 of 5
sten
in reply to: DonovanJr

Bob,

I can see how that could work, but as you said ... CLUNKY.

It seems like such an obvious functionality to want/need in a script.

Thanks
Message 4 of 5
jpiggee
in reply to: sten

Hello,

 

I agree this would be a great tool to use. However, the question filters down to; how would the mechanics of this should work.

 

Given that item.() is directed to look at the Item in question then allow you to choose the tab based on it?

 

How would you like to see this at the workspace interaction level?

Maybe switch to

Tenant.workspace[i].item[i].tab(i) ?

 

So you naturally get an array return of the available workspaces, then an array of the available items with in the workspace, then choose the tab of the item you want, finally what part of the table you want?

 

So it would look something like:

Tenant.workspace[test].item[problem report 0001].tab[item details].FIRST_ENTRY

 

I could see this as an option, but also more confusing and almost just as clunky (not to mention a full over haul of the scripting system that could possibly render all current scripts null)

 

Any thoughts on this, i would love to hear other ideas on how to carry this out?

Joseph Piggee
Fusion 360 Administrator
TPI Composites
jpiggee@tpicomposites.com
Message 5 of 5
sten
in reply to: jpiggee

Joe,

 

Let me try to get specific on what I wanted to do, then you can tell me if there is a better way of doing it.

 

I was looking at the Octopart App. During "lookup" the octopart script does a search on the octopart website and is returned a list of distributors from where the part can be purchased.

 

Right now the script just takes the first 4 matches and adds them to the item record. There does not seem to be any intelligence behind how these 4 entries are selected, just the first 4. In some cases I saw it add 4 different 'digikey' records with the only difference being packaing. I wanted to changes this to:

1) Only show the same distributor once

2) Only show the descributors that I (and not octopart) have approved. 

 

I made a proof of concept of this, but where my approved distributors hardcoded in a script. It works well.

 

Ideally I would want to make a "distributor workspace" where each item in the workspace is a distributor with a approval workflow.

 

All I need to do this is to get the list of DMSID's belonging to my distributor workspace and iterate though them using loadItem() to see if the octopart distributor name matches one of my approved distributors.   (I did see that loadItems was 'Deprecated' but I guess that is another issue).

 

I am still very new to plm360 and my understanding of the underlying database is mostly based on assumptions and past experience. This might be why I fail to understand how this would require a total overhaul of the scripting system. In my mind this would be as simple as to add a function that returns all DMSID's belonging to a predefined WS_WORKSPACE_ID. That information must be in there somewhere and had it been a SQL database interface I would just have done an appropiate SELECT ... WHERE... statement.

 

The function could return an array, space delimited or comma delimited string. Doesn't really matter, that is how to 'workaround' does it anyway.

 

Looking forward to your reponse,

Sten

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report