Scripting: Requery Database S’abonner

0
Avatar
Legacy Poster

I have database-sourced label that needs a lot of validation of user input parameters.

The simple built-in query prompt functionality falls a little short due to the complexity...

 

So instead, I scripted input boxes & notification message boxes to gather the input,

validate it, do some database scripts, queries, etc, and finally I'd like to have BT

requery the database to pickup the newly created/updated/etc records after the vb

script has run.

 

I don't see any methods in the BT objects to do that. Am I missing it, or just trying to do to much inside BT, or take the wrong approach?

 

Thanks,

    Travis-

4 commentaires

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

I think I've over-complicated my question. I just need to be able to run my vbscript BEFORE BarTender queries the DB... or trigger a requery.

(And it needs to be when the user is print the label, not when opening the label or something like that...)

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

[...] do some database scripts, queries, etc. [...]

 

That sounds like you're doing the main database connection & query through VBS already - shouldn't that give you the functionality to requery as needed? Or am I missing the problem? If you are using BT's built-in database functionality, maybe this post http://forums.seagullscientific.com/index.php?/topic/5023-lookup-sql-field/#entry16354 can help you do the same (and more) through VBS.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

KM3,

      Thanks for responding. I've tried many different methods to accomplish things over the years with Bartender, and although I've always managed to make something that was usable, I've basically always run into some kind of hurdle that prevented me from awarding any particular method the defacto "winner". :)

      In this instance, the main database query was a stored procedure that returned a resultset, however since BT can be flaky when a basic table/view isn't supplied, I wanted to try a different approach. (The app doesn't crash entirely, but it can throw errors in the database connection dialogs if you don't enter some valid arguments parameters and let it perform the query before saving- after any edits, and it can't handle output parameters and return values, etc.)

      So I moved the execution of the stored procedure to VBS, check return values, output params, etc for any errors, and then I set the main BT label query to simply refer to a table that contains the rows that the stored procedure generated, which makes BT more stable, as it's clearly (and understandably) more "comfortable" with just a simple table.

      Unfortunately there doesn't seem to be a way to make BT wait on it's initial query or requery afterwards, so this was another failed idea.

 

What did work was just to run all of the VBS outside of BarTender, and call BT's automation interface, after the procedure has completed successfully. As you mentioned, I could have done the entire database connection & query process within VBS inside BT, but assigning the values to the fields on a label format in code would be onerous for a complicated label with many fields. In fact, I'm have trouble doing that in a different label right this second! Lol

 

Trav- 

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

That sounds like what you're doing is way out of my league ^_^ I've had good experience (after a lot of tinkering) with BT and VBS and connecting to databases but I don't think any of that was nearly as involved as what you are doing and certainly doesn't involve edits. I am still kinda surprised requeries are seemingly not possible but as I said, I won't be much help here - sorry.

Vous devez vous connecter pour laisser un commentaire.