Forums: SQL Variables - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

SQL Variables How to include a different field from the lookup wizard record Rate Topic: -----

#1 User is offline   Jake 

  • Member
  • PipPip
  • Group: Members
  • Posts: 26
  • Joined: 02-December 06

Posted 27 February 2019 - 09:01 PM

If I need more flexibility in a lookup dropdown, I'd like to use a form variable in my lookup query.

Say I have a dropdown called PartNumber, and I want to use the selected field in a subsequent dropdown that will require a table join.

The query would look something like this:

SELECT pro2.Mold_Center
FROM dbo.production_partmaster pro
LEFT OUTER JOIN dbo.production_moldtypes pro1 ON pro.moldtype=pro1.id
LEFT OUTER JOIN dbo.production_moldcenter pro2 ON pro1.id=pro2.MoldType
WHERE pro.partno = <selected previous dropdown PartNumber>.

How do I get the <selected previous dropdown PartNumber> from the form?

Any help is appreciated!!

Thanks,

John
0

#2 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 16278
  • Joined: 03-February 03
  • Gender:Male

Posted 02 March 2019 - 04:03 PM

If PartNumber is a numeric field it will be something like this:

SELECT pro2.Mold_Center 
FROM dbo.production_partmaster pro
LEFT OUTER JOIN dbo.production_moldtypes pro1 ON pro.moldtype=pro1.id
LEFT OUTER JOIN dbo.production_moldcenter pro2 ON pro1.id=pro2.MoldType 
WHERE pro.partno = :PartNumber


If PartNumber is a text field it will be something like this:

SELECT pro2.Mold_Center 
FROM dbo.production_partmaster pro
LEFT OUTER JOIN dbo.production_moldtypes pro1 ON pro.moldtype=pro1.id
LEFT OUTER JOIN dbo.production_moldcenter pro2 ON pro1.id=pro2.MoldType 
WHERE pro.partno = ':PartNumber'


More info:
https://xlinesoft.co...qlvariables.htm
Best regards,
Sergey Kornilov
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users