Normal Topic Part of Code not executed in @Mode = 2 - Solved (Read 367 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Part of Code not executed in @Mode = 2 - Solved
Jun 6th, 2012 at 2:28pm
Print Post Print Post  
I have following code command Button and Groups element is ReadOnly ( ) to avoid mistake in not typing correctly.

Code
Select All
var vString1 as String
var vString2 as String
var vAllGroups as String
var vStr as String
var vGroup as String




Subroutine DisplayGroupList ( )

var vLoop as Int
var vRSHandle as int
var vNoOfRecords as int


vRSHandle = @XResultSetSearch(@FN, "Fon", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!Groups=" + "/=") //This will get the all records with value in Groups element
		if(vRSHandle > -1)
		{
			vNoOfRecords = @XResultSetTotal(vRSHandle)
			WriteLn ("No of Records = " + @str (vNoOfRecords) )
			for vLoop = 1 to vNoOfRecords
				WriteLN ("Processing Record " + @Str (vLoop) + " of " + @Str (vNoOfRecords)  )
				XResultSetCurrentPosition(vRSHandle, vLoop)
				vGroup = @FormFieldValue ("Fon", "Groups", vLoop)   //This part is not working in Retrieve Mode
				WriteLn ("Value of vGroup = " + vGroup )

						If vAllGroups = "" then
							{
								vAllGroups = vGroup

							}
							Else
							{
								VAllGroups = vAllGroups + ";" + vGroup
							}




			next

			vAllGroups = @Replace (vAllGroups, ", ", ";")
			vAllGroups = @UniqueStringArray (vAllGroups)
			WriteLn ("All Unique Groups = " + vAllGroups )
			XResultSetClose(vRSHandle)
		}

		PopupSelectPosition(4, @Xpos(ThisElement), @Ypos(ThisElement))
		vStr = @PopUpMenu (vAllGroups, "Choose One")
			If Groups = "" then
				{
					Groups = vStr
				}
				Else
				{
					Groups = Groups + ", " + vStr
				}






End SubRoutine





If @Mode ( ) < 2 then
	{
		vString1 = "Add;Add New;Remove"
		PopupSelectPosition(4, @Xpos(ThisElement), @Ypos(ThisElement))
		vString2 = @PopUpMenu (vString1, "Choose One")
	}

If vString2 = "Add" then
	{
		DisplayGroupList ( )


	}


If vString2 = "Remove" then
	{
		vAllGroups = @Replace (Groups, ", ",  ";" )

		PopupSelectPosition(4, @Xpos(ThisElement), @Ypos(ThisElement))
		vStr = @PopUpMenu (vAllGroups, "Choose One")

		n = @FindStringArray (vAllGroups, vStr)
		vGroup = @DeleteStringArray (vAllGroups, n)
		Groups = vGroup
	}

If vString2 = "Add New" then
	{
		vGroup = @PromptForUserInput ("Name of New Group?", "")
		If vGroup <> "" then
			{
				If Groups = "" then
					{
						Groups = vGroup

					}
					Else
					{

						Groups = Groups + ", " + vGroup

					}


			}

	}

If @Mode ( ) = 2 then
	{
		DisplayGroupList ( )

	}
 



The code works fine in Add and Update mode. In Retrieve Mode I want the command button to display List of Groups but the marked part of the code is not working in retrieve mode. Is is supposed to be like that or I am doing something wrong?
« Last Edit: Jun 6th, 2012 at 5:44pm by Bharat_Naik »  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Part of Code not executed in @Mode = 2 - Solved
Reply #1 - Jun 6th, 2012 at 5:46pm
Print Post Print Post  
Sorry for the trouble. Instead of @FormFieldValue ( ), I used @XResultSetValue ( ) and it worked fine. Thanks.
  
Back to top
 
IP Logged