Normal Topic Reformatting data using sbasic (Read 383 times)
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Reformatting data using sbasic
Nov 4th, 2010 at 3:41pm
Print Post Print Post  
Our users want to be able to copy a row of numbers, into a number field in sesame and then perform a search.

When pasted into the stock# field (number field), sesame shows the line breaks as "^J". Sesame seems to convert the data to just the first number, then runs the search, instead of searching the entire string of numbers.

Data looks like this in notepad and excel

7722
7096
7981
7979

Code looks like this:

var ii as int
var vnum as string = stock#

vnum = @replace(vnum, @nl(), ";")
stock#= @replace(vnum, "^J", ";")

ii =  @selecttreeitem("Search Menu!Search Commands!Retrieve New Results (F10)")

Any thoughts, or do I have to change the stock# field to a text field type to make it work?

Thanks,
Steve
  
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Reformatting data using sbasic
Reply #1 - Nov 4th, 2010 at 4:23pm
Print Post Print Post  
Hello Steve,

You can leave the Stock# field a number element you just need to use FormFieldValue to get and set the values of it since the values are not numbers. Something like

Code
Select All
Var ii as Int  
Var vnum as String

vNum = @FormFieldValue(@Layout, "stock#", 0)
vNum= @Replace(vnum, @Chr(10), ";")
FormFieldValue(@Layout, "stock#", 0, vNum)

ii =  @SelectTreeItem("Search Menu!Search Commands!Retrieve New Results (F10)")  



-Ray
  

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


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Reformatting data using sbasic
Reply #2 - Nov 4th, 2010 at 4:28pm
Print Post Print Post  
Fantastic, Ray! Thanks for the help.
  
Back to top
IP Logged