Simple Scripting S’abonner

0
Avatar
Legacy Poster

I am using Bartender 9.3 I have a label setup which calls a few fields via an ODBC connection to our Progress Database. I have created a text field essentially where I need to have the script look up the customer number associated with the Item # I insert and if it is equal to this specific customer number, display additional text UL123Recognized. I am trying an If then statement, but continually get a syntax error no matter my combination. I have validated my connection to the database works as when I input my inventory number (which is setup as a prompt), it pulls back the description and part number correctly. How can I alter the syntax to get it to disply text on the label for just 1 customer?

Right now, it is below, but still incorrect. If I just put Field("Cust-key")=1234 my result is 0 or -1 based on whether or not the customer is associated with the item.

If Field("Cust-key")=1234 then ("UL123Recognized")


Thoughts? Thanks.

7 commentaires

0
Avatar
Shotaro Ito
Modérateur
Actions pour les commentaires Permalien

Try script like below:
[Code]
ReferenceField("Cust-key")
If Field("Cust-key",0)=1234 then
Value = "UL123Recognized"
End If
[/code]

If the field "Cust-key" is text type, you would do like
[Code]
ReferenceField("Cust-key")
If Field("Cust-key","")="1234" then
Value = "UL123Recognized"
End If
[/code]

hope it helps!
0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

[quote name='Shotaro I -Seagull Support' timestamp='1320135088' post='924']
Try script like below:
[Code]
ReferenceField("Cust-key")
If Field("Cust-key",0)=1234 then
Value = "UL123Recognized"
End If
[/code]

If the field "Cust-key" is text type, you would do like
[Code]
ReferenceField("Cust-key")
If Field("Cust-key","")="1234" then
Value = "UL123Recognized"
End If
[/code]

hope it helps!
[/quote]



This worked great, but now what if it isn't that customer number? I tried adding the following

Else
Value = ""
End If

It seems to take it, but then it can't find the records unless they are related to this customer number. I tried adding a second statement to reference if the customer number is not equal to that customer, same result.

Sorry, my scripting knowledge is limited, so not sure what I'm missing. Scenario, it is working if the item is associated with that customer, otherwise, with or without editing the script, it will not pull up the other records and not display the UL123Recognized which it shouldn't, but it won't display the rest of the record either.

Thanks for your help.
0
Avatar
Shotaro Ito
Modérateur
Actions pour les commentaires Permalien

I'm not sure I understood your question properly - do you mean when "Cust-key" is not 1234, just show the value of Cust-key? if that is the case..

[code]
ReferenceField("Cust-key")
If Field("Cust-key",0)=1234 then
Value = "UL123Recognized"
Else
Value = Field("Cust-key",0)
End If
[/code]
0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

[quote name='Shotaro I -Seagull Support' timestamp='1320194718' post='932']
I'm not sure I understood your question properly - do you mean when "Cust-key" is not 1234, just show the value of Cust-key? if that is the case..

[code]
ReferenceField("Cust-key")
If Field("Cust-key",0)=1234 then
Value = "UL123Recognized"
Else
Value = Field("Cust-key",0)
End If
[/code]
[/quote]


Thank you. Closer. Basically if the customer does not equal 1234, then I want it to display nothing, no text or Customer number, so just show the UL123Recognized when the customer is 1234, otherwise, show nothing. I know it's close to being right, but still missing something.

Thanks again for your help.
0
Avatar
Shotaro Ito
Modérateur
Actions pour les commentaires Permalien

OK, try this way...
[Code]
ReferenceField("Cust-key")
If Field("Cust-key",0)=1234 then
Value = "UL123Recognized"
Else
Value = ""
End If
[/code]
0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

[quote name='Shotaro I -Seagull Support' timestamp='1320381576' post='969']
OK, try this way...
[Code]
ReferenceField("Cust-key")
If Field("Cust-key",0)=1234 then
Value = "UL123Recognized"
Else
Value = ""
End If
[/code]
[/quote]



Thanks for your response. That is what I had in the code too, but something is wrong. If I have it set this way, when I call an item that is associated with the customer 1234, all is well and the UL123Recognized shows up on the label. If the item that is not associated with customer 1234, it tells me "No Records Found" BarTender Error Message #3200.

I am confused why this won't work. Any other suggestions? Thanks.
0
Avatar
Shotaro Ito
Modérateur
Actions pour les commentaires Permalien

Hi Smileyville,
If you still have trouble, Could you tell me how you set up the format and where did you place script?
Is that in Multilne script in a text, or OnProcessData in More options of a text?
Do you use Query prompt in Darabase setup > Query tab?
If no record is selected because of query result, #3200 No record found error would be shown.

Vous devez vous connecter pour laisser un commentaire.