Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why this journal function works ?

Status
Not open for further replies.

Ehaviv

Computer
Jul 2, 2003
1,012
Hi

I'm Confused because. I think
for this if
Code:
 If ItemAlreadyExists Then
   MsgBox("PartNumber Already Exists in TC")
 End If

-----------------------------------------------------------------------
This function shold work
Code:
  Public Function ItemAlreadyExists(ByVal item_id As String) As Boolean    
    Dim ufs As UFSession = UFSession.GetUFSession()
    Dim item_already_exists As Boolean = False
    Dim database_part_tag As Tag
    ufs.Ugmgr.AskPartTag(item_id, database_part_tag)
    If database_part_tag = Nothing Then    
      [b]item_already_exists = True[/b]
    End If
    Return item_already_exists
  End Function
-----------------------------------------------------------------------
And not this. (actualy in my test on nx manager this work. why?
Code:
  Public Function ItemAlreadyExists(ByVal item_id As String) As Boolean    
    Dim ufs As UFSession = UFSession.GetUFSession()
    Dim item_already_exists As Boolean = True
    Dim database_part_tag As Tag
    ufs.Ugmgr.AskPartTag(item_id, database_part_tag)
    If database_part_tag = Nothing Then    
      [b]item_already_exists = False[/b]
    End If
    Return item_already_exists
  End Function

Thank you in advanced

============================================================================
NxOpen API doc

Code:
UF_UGMGR_ask_part_tag (view source) 
Defined in: uf_ugmgr.h 
Overview
Finds the tag of a part in the database corresponding to the specified 
part number. 
In case of Default Domain: it is Team Center Engineering item ID. 
In case of non-Default Domain: it is the multifield key. 
e.g. ,=item_id=001, object_type=Document 
,=item_id=001, object_type=SupplierPart, supplier_code=x 

If the function is successful, the output 
argument contains the database tag of the part. If the function is 
unsuccessful, then the output argument is UF_UGMGR_null_tag. 
Environment
Internal and External  
Required License(s)
gateway 
int UF_UGMGR_ask_part_tag
(
char * part_number, 
UF_UGMGR_tag_t * database_part_tag 
)
char *
part_number
Input
Part number.
UF_UGMGR_tag_t *
database_part_tag
Output
Database tag of the part corresponding to 
the specified part number.


 
Replies continue below

Recommended for you

Code:
UF_UGMGR_ask_part_tag (view source) 
Defined in: uf_ugmgr.h 
Overview
Finds the tag of a part in the database corresponding to the specified 
part number. 
In case of Default Domain: it is Team Center Engineering item ID. 
In case of non-Default Domain: it is the multifield key. 
e.g. ,=item_id=001, object_type=Document 
,=item_id=001, object_type=SupplierPart, supplier_code=x 

[b]If the function is successful, the output 
argument contains the database tag of the part. If the function is 
unsuccessful, then the output argument is UF_UGMGR_null_tag[/b]. 
Environment
Internal and External  
Required License(s)
gateway 
int UF_UGMGR_ask_part_tag
(
char * part_number, 
UF_UGMGR_tag_t * database_part_tag 
)
char *
part_number
Input
Part number.
UF_UGMGR_tag_t *
database_part_tag
Output
Database tag of the part corresponding to 
the specified part number.
 

Sory. shold be.

Code:
If ItemAlreadyExists(PartNumber) Then
   MsgBox("PartNumber Already Exists in TC")
 End If
 
I was wrong in the above posts.
The right situation is as follows:

This routine return true if the
Part number already exists in TC (Tested on nxmanager)

But logically it seems that something
is rong because if part_tag = Nothing
its meaning is the part number have
not a tag and this means this part number
Not exist in TC.

Code:
Public Function ItemAlreadyExists(ByVal item_id As String) As Boolean    
    Dim ufs As UFSession = UFSession.GetUFSession()
    Dim item_already_exists As Boolean = False
    Dim database_part_tag As Tag
    ufs.Ugmgr.AskPartTag(item_id, database_part_tag)
    If database_part_tag = Nothing Then    
      item_already_exists = True
    End If
    Return item_already_exists
  End Function


 
I reveal that
ufs.Ugmgr.AskPartTag(item_id,database_partag)
Not working at all because pattag always null
For any part number.
 
I found my mistake.

Part number should be
Without @DB/ and without revision.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor