Normal Topic Find all unique values used for a layout element. (Read 2168 times)
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Find all unique values used for a layout element.
May 14th, 2019 at 11:16pm
Print Post Print Post  
Just thought I'd share this piece of code I wrote that you can run on mass update. If you ever, want to know all of the choices ever used in a LE field then you can run this code to find all the unique values. It might come in handy if you're trying to update records for consistency or you want to modify or update your "choices" for a combo box LE...

Type "/" in the LE field to be acted upon > Run a search > Switch over to Mass Update (Form) at bottom-left > Double-Click the LE field to be acted upon from the list > Insert code below > Update code as necessary

Record_Type :: On Mass Update

Code
Select All
/*
The purpose of this code is to find all the choices that were ever used for a Layout Element Field.
The process first involves doing a search to pull up a result set of records by using the "/" character
and then pressing "search". Changing to Mass Update FORM. Then double-clicking the Layout Element to be
acted upon. Then inserting this code into it's sBasic.

Also, inserting this sBasic in Global Code:

Stat sList as String
Stat sCount as Int
*/

var vLE as String
var vLEName as String
var vMax as Int

vLE = Record_Type //Insert name of layout element here.
vMax =  5657 //Insert number of records in result set here.

vLEName = @ElementName(vLE)

sList = @UniqueStringArray(@AppendStringArray(sList, vLE))

sCount = sCount + 1

If sCount = vMax
{
	WriteLn("All unique choices for " + vLEName + ":")
	WriteLn(" ")
	WriteLn(sList)
}
 



Switch over to Global Code in the sBasic compiler > Insert code below

Global Code :: On Mass Update

Code
Select All
Stat sList as String
Stat sCount as Int
 



Back out of compiler > Left-click on Mass Update (Form) > Run > Continue

I'm sure there's a better or easier way to do this but this is what I've come up with so far.
  
Back to top
 
IP Logged