If you guys can help please, I need my part number to be same as program number.Part is 123-123 but program number need to be without "-". It should look like this 123123. So no dashes no space just whole number.
What i did it working but make dash too. Is it possible upgrade my rule to do what i described above?
Thanks a lot for any input.
'prompt user for iProperty value
booleanParam = InputRadioBox("Program Number?", "Yes", "No", booleanParam, Title := "Select option")
'set iproperties based upon user input
If booleanParam = True Then
iProperties.Value("Custom", "Program") = iProperties.Value("Project", "Part Number")
Else
booleanParam = False
iProperties.Value("Custom", "Program") = ""
End If
Solved! Go to Solution.
Solved by jdkriek. Go to Solution.
Remember iLogic is essentially VB.net, so you can use the Replace() function
Example:
String.Replace("CharacterToReplace", "")
Here's the revised code for you:
If booleanParam = True Then Dim PartNumber As String = iProperties.Value("Project", "Part Number") iProperties.Value("Custom", "Program") = PartNumber.Replace("-", "") Else booleanParam = False iProperties.Value("Custom", "Program") = "" End If
Jonathan,
Is there a way to modify this code to remove a dash and three digits (whatever the digits may be "-XXX") from a part number and place it in the title block? Example: 485762-002 to 485762.
You could use substring for string manipulation.
If you´re 100% sure it´s always the last three digits of the part number you could do the following.
Dim partnumber As String = partnumber.substring(0,partnumber.length-3)
or if you want to remove the dash as well just -4.
regards
Falk
@LOONYLEN wrote:
Jonathan,
Is there a way to modify this code to remove a dash and three digits (whatever the digits may be "-XXX") from a part number and place it in the title block? Example: 485762-002 to 485762.
Several ways to do this:
'using Substring Dim sPartNumber As String = "485762-002" sPartNumber = sPartNumber.Substring(0, sPartNumber.IndexOf("-")) MsgBox(sPartNumber & " using Substring()") 'using Split() Dim sPartNumber2 As String = "485762-002" sPartNumber2 = sPartNumber2.Split("-"c)(0) MsgBox(sPartNumber2 & " using Split()")
Could also use Left() with InStr() - but you get the idea.
@falkmassmann wrote:
You could use substring for string manipulation.
If you´re 100% sure it´s always the last three digits of the part number you could do the following.
Dim partnumber As String = partnumber.substring(0,partnumber.length-3)
or if you want to remove the dash as well just -4.
regards
Falk
You don't need to be sure of the number of digits if you use IndexOf - just that it has a dash.
sPartNumber.Substring(0, sPartNumber.IndexOf("-"))