Normal Topic @XResultSetSearch “!field=” variable? (Read 413 times)
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
@XResultSetSearch “!field=” variable?
Jan 26th, 2012 at 4:33pm
Print Post Print Post  
I have a form with several check boxes, I use @XResultSetSearch to find a particular checkbox record. So, the field_spec_list would look like this “!Checkbox=” + vFirstbox. That works fine by setting vFirstbox to 1 and running @XResultSetSearch. Since I have several checkboxes, is there a way to change the “!field=” depending on the checkbox I want to search for rather than having to list each checkbox field? In other words, a variable for the "!field="?

Example, I would use @Popupmenu (only because it fits nicer for this application) to list the checkboxes, then when Secondbox is selected the “!field=” would be changed to this “!SecondCheckbox=” ,or assuming that it would be a variable, “!Checkbox=” would remain the same but receive the Secondbox variable.

Something like this.
Code
Select All
vRS =  @XResultSetSearch(@FN, "Contacts, 0,2,  "!FieldVariable=" + vCheckbox)

If Choice = "01"
{
Set  "!FieldVariable="  to Checkbox 1
vCheckbox = 1
}

If Choice = "02"
{
Set "!FieldVariable="  to Checkbox 2
vCheckbox = 1
}
 


  
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: @XResultSetSearch “!field=” variable?
Reply #1 - Jan 26th, 2012 at 6:11pm
Print Post Print Post  
Yes you can use a variable for that as it's a string containing the name of the field.

Something like the following should work for you.

Code
Select All
Var vChoice as String
Var vField as String
Var vRS as Int
Var vCheckbox as Int

vChoice = @PopupChoiceList("Which CheckBox?", "01;02")
If vChoice <> "" Then
{
	If vChoice = "01"
	{
		vField = "Checkbox 1"
		vCheckbox = 1
	}
	Else If vChoice = "02"
	{
		vField =  "Checkbox 2"
		vCheckbox = 1
	}

	vRS =  @XResultSetSearch(@FN, "Contacts", 0, 2, "!" + vField  + "=" + vCheckbox)
} 



-Ray
  

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



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: @XResultSetSearch “!field=” variable?
Reply #2 - Jan 26th, 2012 at 6:33pm
Print Post Print Post  
Outstanding!

Thank you Ray!
  
Back to top
IP Logged