//--The answer was row.GetOriginalValue--
private async void SsPltbtn_Click(object sender, EventArgs e)
{
GVar.PltVal = null; //global variable to carry attribute field value.
if ((MapView.Active.Map.SelectionCount == 1) && (Pltsrch_txtbx.Text != null) && (Pltsrch_txtbx.Text != ""))
{
await ActMap(); //active map checker
Map map = MapView.Active.Map;
var QS_lyr = map.FindLayers("Quarter Section").FirstOrDefault() as FeatureLayer;
if (QS_lyr == null) { return; }
await QueuedTask.Run(() =>
{
var QS_TD = QS_lyr.GetTable().GetDefinition(); //table definition of featurelayer
var Find_Fld = QS_TD.FindField("PS_CODE"); //find the search field index
var QS_lyr_sel = QS_lyr.GetSelection(); //This is NOT a table, but a Selection -- it works.
using (RowCursor rowCursor = QS_lyr_sel.Search()) //http://pro.arcgis.com/en/pro-app/sdk/api-reference/index.html#topic7003.html
{
while (rowCursor.MoveNext())
{
using (Row row = rowCursor.Current)
{
string OrigVal = row.GetOriginalValue(Find_Fld) as string;
GVar.PltVal = OrigVal;
}
}
}
});
try
{
var filepath = @"C:\GISdata\Plat_Sheets\PDF\Sewer\" + GVar.PltVal + ".pdf";
System.Diagnostics.Process.Start(filepath);
}
catch (Exception)
{
MessageBox.Show(" The filepath is incorrect or file is missing.", "File Not Found",
MessageBoxButtons.OK,
MessageBoxIcon.Warning,
MessageBoxDefaultButton.Button1,
MessageBoxOptions.DefaultDesktopOnly);
return;
}
}
else { return; }
}