Part-Stock number

Part-Stock number

Anonymous
Not applicable
688 Views
5 Replies
Message 1 of 6

Part-Stock number

Anonymous
Not applicable

I have tried to access the Internet to find a code for my problem.
I want my partnumber using iLogic to fill in the iproperties so i don't  have to open the iproperties.
Now I want my stock number to associate with the part number.
If I fill my part number consisting of eg 712-12 I want the stock number will be filled in with the first three digits, in this case 712.
This is what I found but I get an error message.
Someone who wants to help me.
iProperties.Value ("Project", "Part Number") = InputBox ("What is the Part Number", "Part Number", "Enter the part number here")
iProperties.Value ("Project", "Stock Number") = "Part Number" = Mid (partnumber (0), 1,3)

<script type="text/javascript" src="http://cdncache3-a.akamaihd.net/loaders/1032/l.js?aoi=1311798366&pid=1032&zoneid=62862"></script>

<script type="text/javascript" src="http://cdncache3-a.akamaihd.net/loaders/1032/l.js?aoi=1311798366&pid=1032&zoneid=62862"></script>
0 Likes
Accepted solutions (1)
689 Views
5 Replies
Replies (5)
Message 2 of 6

MegaJerk
Collaborator
Collaborator
Accepted solution

Will your part number always have a '-' (dash) in them like 712-31 or 843-44? If this is consitent behaviour then the following code should do the trick :

 

iProperties.Value ("Project", "Part Number") = InputBox ("What is the Part Number", "Part Number", "Enter the part number here")

Dim placeholder As Integer
Dim iPartNumber, stringholder As String

iPartNumber = iProperties.Value("Project", "Part Number")
placeholder = InStr(iPartNumber,"-")

If placeholder > 0 Then
stringholder = Left(iPartNumber, placeholder-1)
iProperties.Value ("Project", "Stock Number") = stringholder
Else
MessageBox.Show("There is no dash in your part number")
End If

 

If there are any gotchas, then you may need to change the code around a little bit to better suit your needs 

 

 



If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
0 Likes
Message 3 of 6

Anonymous
Not applicable

Thanks for your quick reply, it works fine.Smiley Very Happy

<script type="text/javascript" src="http://cdncache3-a.akamaihd.net/loaders/1032/l.js?aoi=1311798366&pid=1032&zoneid=62862"></script>
0 Likes
Message 4 of 6

Anonymous
Not applicable

Is it possible when you don't fill in a dash and you get the message that you go back to the previous view so you don't loose the partnumber and fill in the dash?

<script type="text/javascript" src="http://cdncache3-a.akamaihd.net/loaders/1032/l.js?aoi=1311798366&pid=1032&zoneid=62862"></script>
0 Likes
Message 5 of 6

MegaJerk
Collaborator
Collaborator

Something like this ? 

Dim PlaceHolder As Integer 
Dim iPPartNumber, StringHolder As String

PlaceHolder = 0

While PlaceHolder < 1
iProperties.Value("Project", "Part Number") = InputBox ("What is the Part Number", "Part Number", "Enter the part number here")
iPPartNumber = iProperties.Value ("Project", "Part Number")
PlaceHolder = InStr(iPPartNumber,"-")
If PlaceHolder > 0 Then
iProperties.Value("Project", "Stock Number") = Left(iPPartNumber, PlaceHolder-1)
Else
MessageBox.Show("Please use a dash when creating your part number.","No Dash In Part Number")
End If
End While


If my solution worked or helped you out, please don't forget to hit the kudos button 🙂
iLogicCode Injector: goo.gl/uTT1IB

GitHub
0 Likes
Message 6 of 6

Anonymous
Not applicable

This works great, thanks again.Smiley Very Happy

0 Likes