KeepFields

Takes two parameters, FieldBase, FieldNamesList

Description:
The specified Fields will be reorganized into the new order and all others will be discarded.

The FieldNamesList may include additional field bases and wildcards as follows:

Examples:

In the first example below, we are keeping the Work Query fields "FirstName", "LastName", "Age", and "DateJoined" from the "MemTab.Person" record with the alias pAlias.

In the second example below, we first set our Work Query field "MemTab.Person.Alias" to to the alias of the the SessionUser. We then get the record for that alias and use the Children command to get its roles. Lastly, we keep the Work Query fields "FirstName and "LastName" from the table "MemTab.Person" and "Type" from the table "MemTab.Group", which is "MemTab.Person" record's child table.

In the third example, all fields from the MemTab.Person table are kept, then a single individual field named Groups is kept, and then from the Finance.Product table the fields Alias, Name, Type, and Intro are kept first, then followed by all other fields from that table.

LoadRecord "MemTab.Person.Alias", pAlias
KeepFields "MemTab.Person.", "FirstName LastName Age DateJoined"

SetNew "MemTab.Person.Alias", ("`" & $SessionUser)
Get "MemTab.Person"
Children "MemTab.Group"
KeepFields "MemTab.Person.FirstName MemTab.Person.LastName MemTab.Group.Type"

'Third example does not show loading of data for it
KeepFields "MemTab.Person.* *.APIKey *Error*  Groups  Finance.Product.|Alias|Name|Type|Intro|*"