• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Select Question

Explorer ,
Jul 11, 2007 Jul 11, 2007

Copy link to clipboard

Copied

Say I am passing a variable through a drop down select menu to the next page and the output looks like this HB54Htg1. It is actually two variables #location##controller#. The left 4 character will always be the building code. Whatever comes after is always the controller name. I need to query to get a serial number based on what the building is and what the controller is.

I'm having trouble writing a select statement that is something like:

Select SN from inventory
where location.inventory = '#left(form.controller, 4)#' and Controller.inventory = The rest of the string after the left 4 characters.

Can anyone help me out?
TOPICS
Advanced techniques

Views

300

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 11, 2007 Jul 11, 2007

Copy link to clipboard

Copied

...
and Controller.inventory = '#right(form.controller, len(form.controller)
- 4)#'

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 11, 2007 Jul 11, 2007

Copy link to clipboard

Copied

shouldn't they be inventory.location and inventory.Controller instead?

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 11, 2007 Jul 11, 2007

Copy link to clipboard

Copied

LATEST
Try this:

<cfset passedInString = "HB45aks93020" />
<cfset location = Left(passedInString, 4) />
<cfset controller = Mid(passedInString, 5, Len(passedInString)) />

<cfoutput>
#location# -- #controller#
</cfoutput>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation