Can a BAQ do to file exist search on a network location?


(Brandon Anderson) #1

I’m just wondering if a BAQ can do a file search to see if a file exists or not? I can do it in excel if I need to, but it would be slick in a BAQ,


File Exists BAQ
(Jose C Gomez) #2

Short answer, no… longer answer… if you create a function in SQL and call that function within your BAQ… then yes…(Maybe) but right tool / right job…


(Jose C Gomez) #3

(Brandon Anderson) #4

If I customize a dashboard could I do it in C#?


(Jose C Gomez) #5

Absolutely


(Jose C Gomez) #6

Heck you can even do it with an Updatable BAQ… now that I think about it… post Processing BPM on GetList set the value of a calculated field… something like

foreach(var x in ttResults)
{
     x.MyCalculatedField= System.IO.File.Exists(x.FileLocationFromBAQField);
}

(Brandon Anderson) #7

off to see the google!!


(Brandon Anderson) #8

If I’m aggregating stuff on a job, (just looking to see if I’ve created the NC files), it probably won’t work that way though right? I need specific Assembly sequences for any BO to work wouldn’t I?

Back to the C# idea I think.


(Jose C Gomez) #9

Not sure I follow…
An “Updatable” BAQ doesn’t have to have any actual updates. But it will execute the “GetList” code (C#) which can do some C# magic with your fields and populate some data’s


(Jose C Gomez) #10

Something like this
Made a BAQ which looks at XFileRef table

Added a calculated Boolean called FileExits and set it to true

Made the BAQ Updatable and added PostProcessing Directive on GetList() which checks if file exists and assigns True/False to my calculated field.

Run BAQ

Sample BAQ
FileExists.baq (27.8 KB)


(Brandon Anderson) #11

The business object is looking for some fields. How do I not use this?


(Brandon Anderson) #12

Looks like it’s this. I’ve never used that before. Good to know.


(Jose C Gomez) #13

I attached the BAQ, have a look


(Brandon Anderson) #14

For some reason it’s not changing the value. It just reads whatever I have in the calculated field.

Any idea why that would be happening?


(Jose C Gomez) #15

What does the code look like?


(Brandon Anderson) #17

Never mind, I forgot to check the enable check box, now it changes them all to false so, Now I have some file naming problems, but I think that has to do with mapped drives. I need to get the actual server name in there.

Fixed that now it works!!!

Thanks for your help. This will help me save a lot of time.

Here’s your Gold star for the day


(Brandon Anderson) #18

Hey, Old thread I know, but I have a question on this. If you have a field being updated by a BAQ BPM, is there a way to filter by that result in the query? I want to use it for a baq gadget where there is no filtering so it needs to be done in the BAQ. The Subquery filter seems to run before the change of the field.

Thanks