Normal Topic Searching for a list of values from a file. (Read 611 times)
NHUser
Full Member
***
Offline



Posts: 320
Location: Amherst, NH
Joined: Aug 2nd, 2010
Searching for a list of values from a file.
Mar 31st, 2016 at 8:37pm
Print Post Print Post  
I have a file that contains the names of customer specifications called "Customer Specs".  From another file called "Work Instructions", using the programming below, I search all the records in Customer Specs and select only those records that match the beginning of the "Customer" element in Work Instructions.  I only use the first four characters of the Customer element for my search.

When I try to use more characters, the programming doesn't work correctly if there is a space in the name.  For example, I find all the records for a customer named "Jet Parts" when I use the left-most four characters.  If I expand to 6 characters, nothing is selected and the list is blank.  I believe the space between "Jet" and "Parts" is causing a problem.

This can cause some confusion because I have different customers that start with "Jet", for example, "Jet Parts", "Jet Avion", "Jet PMA", etc.

Is there a better way to create this list that avoids this problem? 

Any help would be greatly appreciated.



Var str1 as string
Var str2 as string
var vTemp as Int
var vPos as Int
var vName as string
var vName2 as string

vName=Customer
vName2=Customer

vName=@Left(vName,4)
vName2=@Left(vName2,7)

// change vName to FISHER for EMERSON name

if vName2="EMERSON" then vName="FISH"


vName=vName+".."

PopupSelectPosition(6, @XPos(ThisElement), @YPos(ThisElement))


STR1=@XLookupSourceListAll(@fn,vName,"CUSTOMER SPECS!CSPECS","CSpecs;Revision")

STR1 = @replace(STR1,";"," ~ Rev: ")

STR1 = @replace(STR1, @Chr(10), ";")

STR1 = @SORTSTRINGARRAY(STR1, 0)



STR2=@PopupChoiceList(STR1,"SELECT A SPECIFICATION")

STR2 = @Left(STR2,@Instr(str2, "~")-1)


     If @Len(STR2) > 0
     {
           vTemp = @ASynchShell("F:\Sesame docs\ts doc Customer Specs\"+STR2)
     }
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Searching for a list of values from a file.
Reply #1 - Apr 1st, 2016 at 3:15pm
Print Post Print Post  
Hey Paul,

You may have something else going on as I changed the code to
Code
Select All
vName=@Left(vName,6) 

and was able to find records for "Jet Parts" in the copy of your design that I have here. (I did have to go in and add 2 Jet Parts records to the Customer Specs database as the DSR I have from last month only had records for Jet Avion in it)

I have some time available this afternoon if you're available. Just give me a call.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged