Label w/ Drop Down List VBScript Source - Named Data Source Issue
We have a set of labels that use a Query Prompt to pull a single record from a database that loads Form fields with various "Job" related label information (job number, description, PO #).
The Form also has a Dropdown List that is attempting to pull a set of additional database records related to the Job/Query Prompt value via the VBScript OnFillList Control Event. The script is creating an ADODB Connection/Recordset to execute a SQL SELECT (with the Named Data Source value as a WHERE clause) to get the list values to return to the Dropdown List.
The script is attempting to grab the value of a Named Data Source which has a Data Source of a Database Field that is loaded from a field from the initial database source/query prompt lookup.
jobNumber = Format.NamedSubStrings("job").Value
The value of Named Data Source does not seem to be pulling that value prior to the statement executing because the Dropdown List is not being populated. I can hardcode a value into the jobNumber local variable and have it correctly pull the records from the database into the Dropdown List so I'm confident the SQL / VBScript is correct in pulling records (it's primarily code pulled from the forum on how to use the OnFillList method for a DDL).
The Form also has a Text Box Input field that has the same Data Source as the Named Data Source and it is loading successfully when the Form is ultimately displayed for user interaction.
Is there a technique to force the database data into these Named Data Source objects prior to using them in VBScript?
---
BarTender Enterprise Automation / Designer 2016 R8
SQL Server 2016 data source
-
It sounds like you are processing the VB at the wrong time and so you may need to make these fields Event Controlled VB script routine and perhaps using OnNewRecord for when the script is running
0 -
Hi Pete - thanks for the feedback.
Do I have any control over when the OnFillList control event occurs? I was under the assumption that the Event would run sometime after the initial database SELECT based on the Query Prompt that loaded the Named Data Sources and Form fields that had a Database Field type.
I'm not completely sure I understand how to use the OnNewRecord (document level?) to help manage the timing of this OnFillList event. Can you share more on the strategy here? Can I generate a global variable or something to later reference in the OnFillList event?
I probably should have noted that these Label(s) were behaving as expected for years and just recently fell apart on this Dropdown List OnFillList event. I can't attribute any particular thing that made them stop working.
0 -
Sorry not sure I no longer have access to v2016 so I dont know if anything has changed with this
0
Please sign in to leave a comment.
Comments
3 comments