iLogic error help with syntax error

iLogic error help with syntax error

DJFore
Advocate Advocate
1,237 Views
3 Replies
Message 1 of 4

iLogic error help with syntax error

DJFore
Advocate
Advocate

I have a line in my code that is

"N" & NUM1=PC

with this I get a syntax error

 

N is just a letter

N1, N2, N3 thru N20 are text parameters 

NUM1 is a text parameter that contains a multitext value of numbers (1-20)

PC is a line of text "Apples are good" 

 

What I want it to do is pair the "N" with a selected number and put the line of text (PC) in the specified (N1, N2, N3, etc..) parameter.

 

Such as if NUM1=1 and PC="Apples are good"

then

"N" & NUM1 = PC

Would be 

N1="Apples are good"

 

I have tried testing the "N" & NUM1 to see if this does return N1 and it does if I go the opposite direction X="N" & NUM1 then it makes X=N1

 

What other way can I right the "N" & NUM1 to get the correct result, and not get a syntax error?

 

 

0 Likes
1,238 Views
3 Replies
Replies (3)
Message 2 of 4

ADSKDJW4
Alumni
Alumni

Hello djf,

I will move this post into the customization forum where it is beeter served there.

Regards,

Don

0 Likes
Message 3 of 4

MegaJerk
Collaborator
Collaborator

What you're trying to do can be done, but (at least in the context of iLogic) should be approached like - 

Dim PC As String 
PC = "Apples Are Good"

Parameter.Param("N" + NUM1).Value = PC


Just saying 

"N" & NUM1 = PC


Doesn't mean anything to the compiler. By just typing in a string (in this case "N"), you've given the compiler some sort of input that is not recognized as an instruction or a variable, so it gets cranky.

---

Because I don't have any information on the bigger problem it would seem that you're trying to solve (with all of these parameters), I can only speculate, but most likely there is some room for other optimizations as this is a strange way one would update the value of a parameter.

Would you be interested in going into more details about what it you're trying to accomplish?



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 4 of 4

DJFore
Advocate
Advocate

What I am building is a notes configurator for our company this is the form shown below (all things in red are the parameters) Basically my user fills out the Prod Contact/Non-Prod Contact etc.. then select a number to the right that places it in a numbered order on the drawing. 1 = Note #1, 2 = Note #2, 0= Turns off that note.

 

Form.JPG

 

So I got the rule to work if I write it out in what I consider long form but I was looking for a way to make it much more compact. This is the two sections of code I have for PC and NPC shown below. This works but is very long expecially since I have 20 fields. PC=field #1, NPC= field #2, etc.... 

So I noticed a pattern see below if the NUM1="1" then N1 =PC well if its going to be "N" and the matching NUM# then why just not say "N"+NUM#= N# hence the question. I started with.

 

'PREDEFINED NOTES
'[
PC = "ALL PRODUCT CONTACT MATERIAL WILL BE " & NOTES_PC & "."
NPC = "ALL NON-PRODUCT CONTACT MATERIAL WILL BE " & NOTES_NON_PC & "."
PCF = "ALL PRODUCT CONTACT MATERIAL WILL HAVE A " & NOTES_PC_FINISH & " MAX FINISH."
NPCF = "ALL NON-PRODUCT CONTACT MATERIAL WILL HAVE A " & NOTES_NONPC_FINISH & " MAX FINISH."
STW = "SANITARY TUBING WELDS - " & STW_ID & " ID AND " & STW_OD & " OD, " & STW_LOC & "."
']


'Puts #1 Line in any of the 20 fields
'[
If NUM1 = "1" Then
N1 = PC 
ElseIf NUM1= "2" Then
N2 = PC
ElseIf NUM1= "3" Then
N3 = PC
ElseIf NUM1= "4" Then
N4 = PC
ElseIf NUM1= "5" Then
N5 = PC
ElseIf NUM1= "6" Then
N6 = PC
ElseIf NUM1= "7" Then
N7 = PC
ElseIf NUM1= "8" Then
N8 = PC
ElseIf NUM1= "9" Then
N9 = PC
ElseIf NUM1= "10" Then
N10 = PC
ElseIf NUM1= "11" Then
N11 = PC
ElseIf NUM1= "12" Then
N12 = PC
ElseIf NUM1= "13" Then
N13 = PC
ElseIf NUM1= "14" Then
N14 = PC
ElseIf NUM1= "15" Then
N15 = PC
ElseIf NUM1= "16" Then
N16 = PC
ElseIf NUM1= "17" Then
N17 = PC
ElseIf NUM1= "18" Then
N18 = PC
ElseIf NUM1= "19" Then
N19 = PC
ElseIf NUM1= "20" Then
N20 = PC
End If
']

'Puts #2 Line in any of the 20 fields
'[
If NUM2 = "1" Then
N1 = NPC 
ElseIf NUM2= "2" Then
N2 = NPC
ElseIf NUM2= "3" Then
N3 = NPC
ElseIf NUM2= "4" Then
N4 = NPC
ElseIf NUM2= "5" Then
N5 = NPC
ElseIf NUM2= "6" Then
N6 = NPC
ElseIf NUM2= "7" Then
N7 = NPC
ElseIf NUM2= "8" Then
N8 = NPC
ElseIf NUM2= "9" Then
N9 = NPC
ElseIf NUM2= "10" Then
N10 = NPC
ElseIf NUM2= "11" Then
N11 = NPC
ElseIf NUM2= "12" Then
N12 = NPC
ElseIf NUM2= "13" Then
N13 = NPC
ElseIf NUM2= "14" Then
N14 = NPC
ElseIf NUM2= "15" Then
N15 = NPC
ElseIf NUM2= "16" Then
N16 = NPC
ElseIf NUM2= "17" Then
N17 = NPC
ElseIf NUM2= "18" Then
N18 = NPC
ElseIf NUM2= "19" Then
N19 = NPC
ElseIf NUM2= "20" Then
N20 = NPC
End If
']

Now I plugged in the expanded version of the answer I recieved see below

 

Dim PC As String
Dim NPC As String
Dim PCF As String
Dim NPCF As String
Dim STW As String
PC = "ALL PRODUCT CONTACT MATERIAL WILL BE " & NOTES_PC & "."
NPC = "ALL NON-PRODUCT CONTACT MATERIAL WILL BE " & NOTES_NON_PC & "."
PCF = "ALL PRODUCT CONTACT MATERIAL WILL HAVE A " & NOTES_PC_FINISH & " MAX FINISH."
NPCF = "ALL NON-PRODUCT CONTACT MATERIAL WILL HAVE A " & NOTES_NONPC_FINISH & " MAX FINISH."
STW = "SANITARY TUBING WELDS - " & STW_ID & " ID AND " & STW_OD & " OD, " & STW_LOC & "."

Parameter.Param("N"+NUM1).Value=PC
Parameter.Param("N"+NUM2).Value=NPC
Parameter.Param("N"+NUM3).Value=PCF
Parameter.Param("N"+NUM4).Value=NPCF
Parameter.Param("N"+NUM5).Value=STW

But It doesnt seem to be working correctly it seems to be randomly turning the notes on and off when I chose the placement number.

I do have something that works but I thought I might be able to simplify it. If so great, if not thats ok too.

Thanks,

 

 

 

 

 

0 Likes