I know there have been many post on how to do this but this was done by someone else and I am trying to alphabetize it.
Here are sample code:
public void CTRL10_5_Clicked(object sender, ClickedEventArgs e)
{
XPathNodeIterator players = DataSources["BookingTempEntity"].CreateNavigator().Select(
"/dfs:myFields/dfs:dataFields/ns1:BookingTemp/@Entity", NamespaceManager);
string group = "/my:myFields/my:EntityGroup";
string field = "/my:myFields/my:EntityGroup/my:Entity";
foreach (XPathNavigator player in players)
{
string number = player.Value;
//player.SelectSingleNode("Entity", NamespaceManager).Value;
AddItem(group, field, number);
}
}
private void AddItem(string group, string field, string itemId)
{
XPathNavigator DOM = MainDataSource.CreateNavigator();
XPathNavigator group1 = DOM.SelectSingleNode(group, NamespaceManager);
XPathNavigator field1 = DOM.SelectSingleNode(field, NamespaceManager);
XPathNavigator newNode = field1.Clone();
newNode.SetValue(itemId);
group1.AppendChild(newNode);
}
The connection file is:
BookingTempEntity
Format: UDC V2; Connection Type: Database;
connection string goes here
select Distinct "Entity" from "dbo"."BookingTemp" as "BookingTemp"
Specify a filename or formula