Assign a unique ODBCImport result to a variable
Forums
Hi there.
I'm working on a script that receives at least 6 input values: login, password, initial date, final date, main office, and local office.
The last 2 variables get a number (office identifier), but I only care about one of them: main office. I would like to query the description associated to that office number (unique value) and assign it to a variable in order to concatenate that value to every name of database or file I generate by executing my script.
Any advice or sample would be more than welcomed. Thanks a lot!
Thank you very much, Chris.
Thank you very much, Chris. The matter is there are 153 rows on that table, I would like write a dynamic code. The most dynamic the best. Now I found a script which create an idea file (IMD) where the catalog was imported and then a function populate the combobox from that file! I'm having a funny time with this vb language versiĆ³n on idea. LOL.
Hi idemnos,
Hi idemnos,
so you have a table with 153 main office identifiers right?
I would say it is the best way to import that table to idea like you do it.
With joining it to the other table you should decode the main office with no problems.
You could just append a new field with a "if"-eqn to decode.
Maybe a screenshot or something else would be better to understand (for me) what you are looking for.
Cheers,
Chris
And yes, coding with idea script make lot of fun :D
Hi,
Hi,
maybe I do not get the Problem, but what about coding the description of the main office in the same Script. If you declare the descriptions as global variables and in the Sub Main you could define the descriptions.
Dim sMainOffice1 As String
Dim sMainOffice2 As String
Dim sMainOffice3 As String
Dim sMainOffice4 As String
Sub Main
Dim id As Integer
Dim id1 As Integer
Dim id2 As Integer
Dim id3 As Integer
Dim id4 As Integer
sMainOffice1 = "abc"
sMainOffice2 = "def"
sMainOffice3 = "xyz"
sMainOffice4 = "qed"
sMainOffice99 = "unknown"
id1 = 1
id2 = 2
id3 = 3
id4 = 4
id = InputBox("Please insert numeric idetifier (1-5): ", "Identifier", 99)
If id = id1 Then
MsgBox "Identifier: " & Chr(13) & id1 &Chr(13) & Chr(13) & "MainOffice: " & Chr(13) & sMainOffice1 & Chr(13),0,"Decoding"
ElseIf id = id2 Then
MsgBox "Identifier: " & Chr(13) & id2 &Chr(13) & Chr(13) & "MainOffice: " & Chr(13) & sMainOffice2 & Chr(13),0,"Decoding"
ElseIf id = id3 Then
MsgBox "Identifier: " & Chr(13) & id3 &Chr(13) & Chr(13) & "MainOffice: " & Chr(13) & sMainOffice3 & Chr(13),0,"Decoding"
ElseIf id = id4 Then
MsgBox "Identifier: " & Chr(13) & id4 &Chr(13) & Chr(13) & "MainOffice: " & Chr(13) & sMainOffice4 & Chr(13),0,"Decoding"
Else
MsgBox "Identifier: " & Chr(13) & id &Chr(13) & Chr(13) & "MainOffice: " & Chr(13) & sMainOffice99 & Chr(13),0,"Decoding"
End If
End Sub
Sure it only works if the description is not always changing.
So if the office identifier is 1 than use sMainOffice1, for 2 use sMainOffice2,.... to decode the description.
Cheers,
Chris