Topic Options
#22465 - 11/17/08 02:57 PM Querying database for existing components
dgorsman Offline
Member

Registered: 02/28/06
Posts: 1646
I'm trying to write a query expression to run on the database so I can filter out these items when running reports. Thing is, I can't find any SQL functions for easily dealing with the bit-coded values like those in the FLAG field. Any suggestions?
_________________________
If you are going to fly by the seat of your pants, expect friction burns.

Top
#22495 - 11/18/08 05:52 AM Re: Querying database for existing components [Re: dgorsman]
Wolfe Offline
CGNP
Member

Registered: 10/27/06
Posts: 1182
Loc: South Carolina, US
If you are using VBA the operands are already bitwise. See the "Ambiguous Operators" section. For true SQL, see this article "SQL bitwise" . Hope that helps.
_________________________
Dave Wolfe

Top
#22504 - 11/18/08 09:35 AM Re: Querying database for existing components [Re: Wolfe]
dgorsman Offline
Member

Registered: 02/28/06
Posts: 1646
Somewhat. Eventually it will be using VBA and I will be able to work that out then, but right now its just using filters and queries. There are no bitwise operations that I can see - & is used to concatenate strings and AND is used for logic control rather than an operator.

After an afternoon of playing with the syntax (joy...), it looks like it will be a round-about solution. ([FLAG] Mod 8) gives a result of >= 4 if bit 4 is set, < 4 if bit 4 is cleared. For example, with FLAG as 519 (512 + 4 + 2 + 1) it gives a result of 7 while with FLAG as 515 (512 + 2 + 1) it gives a result of 3.
_________________________
If you are going to fly by the seat of your pants, expect friction burns.

Top
#22515 - 11/18/08 01:21 PM Re: Querying database for existing components [Re: dgorsman]
Wolfe Offline
CGNP
Member

Registered: 10/27/06
Posts: 1182
Loc: South Carolina, US
Hopefully the attached db will save you some joy. I created a created vba function that you can use in a query. There is a sample query demonstrating it's use. Also attached is a pdf defining the flag/status fields.


Attachments
489-STATUSFlag.pdf (671 downloads)
491-TemplateDB.zip (348 downloads)



Edited by Wolfe (11/20/08 06:05 AM)
_________________________
Dave Wolfe

Top
#22561 - 11/19/08 06:21 PM Re: Querying database for existing components [Re: Wolfe]
dgorsman Offline
Member

Registered: 02/28/06
Posts: 1646
I can't seem to get the ZIP to download, but thanks anyways.
_________________________
If you are going to fly by the seat of your pants, expect friction burns.

Top
#23036 - 12/05/08 06:37 AM Re: Querying database for existing components [Re: dgorsman]
shollinger Offline
Member

Registered: 07/20/05
Posts: 281
Loc: Baton Rouge
I am trying to run the plant database here for one specific client. I am loving the ability to change descriptions, sort by line number etc. My problem is that I don't have enough experience with database to query out the existing components when trying to run my global BOM. I found the flag valve sheet from wolfe above but don't really understand how to use that without vba or sql.
_________________________
shollinger

Top
#24169 - 01/28/09 03:12 PM Re: Querying database for existing components [Re: shollinger]
shollinger Offline
Member

Registered: 07/20/05
Posts: 281
Loc: Baton Rouge
I finally got the time to figure out a simple query for existing components in the plant pro database.

SQL
SELECT PIPE.DWG_NAME, PIPE.ALPHA_SIZE, PIPE.LINE_NUM, PIPE.LONG_DESC
FROM PIPE
WHERE (((([PIPE]![FLAG]\(4)) Mod 2)=0));

Thanks for pointing me in the right direction Wolfe.

Steve

_________________________
shollinger

Top
#24170 - 01/28/09 03:16 PM Re: Querying database for existing components [Re: shollinger]
Wolfe Offline
CGNP
Member

Registered: 10/27/06
Posts: 1182
Loc: South Carolina, US
Nicely done. Glad to be of help.
_________________________
Dave Wolfe

Top
#29204 - 08/11/09 09:30 AM Re: Querying database for existing components [Re: Wolfe]
kpravin Offline
Member

Registered: 04/07/09
Posts: 29
Loc: Mumbai, India
Thanks a lot Shollinger & Dave Wolfe

You solved my problem


Top



Moderator:  Dominik Hepp 
Who's Online
0 registered (), 31 Guests and 0 Spiders online.
Key: Admin, Global Mod, Mod
May
Su M Tu W Th F Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Forum Stats
12065 Members
14 Forums
16973 Topics
75151 Posts

Max Online: 303 @ 01/28/20 11:58 PM
Top Posters (30 Days)