DataTable double values

I have coded up my own activity where I return a datatable that exists of 1 string value, 2 double values per row. Now I need to validate the two doubles against one another: row("Confidence") < row("Threshold") but due to Strict on, I can’t do this so I thought I’ll just cast them to doubles since that’s what they are: Double.Parse(row("Confidence")) < Double.Parse(row("Threshold")) but that’s not allowed because object can’t be implicitly casted to string. How can I get the values to compare them?

@Mout_pessemier

you can bring the row value into a string with tostring
e.g. Double.Parse(row("Confidence").toString)

1 Like

That’s what I’ve tried but He still keeps on complaining about the strict on stuff

@Mout_pessemier
can you share sample data of a row?

I’m sorry, I went to eat. Here is how I build up the data table in my code:

 DataTable dataTable = new DataTable();
                dataTable.Clear();
                dataTable.Columns.Add("EntityName");
                dataTable.Columns.Add("Confidence");
                dataTable.Columns.Add("Threshold");

                // we make a data table with all the entities in it so that we can do whatever we want with them in the rest of our workflow
                foreach (var document in pr.Documents)
                {
                    foreach (var entity in document.Entities)
                    {
                        DataRow row = dataTable.NewRow();
                        row["EntityName"] = entity.Type.Name; // string
                        row["Confidence"] = entity.Confidence; // double (e.g. 0.7854981984)
                        row["Threshold"] = document.DocumentType.Threshold; // double (0.75)
                        dataTable.Rows.Add(row);
                    }
                }
                JsonResult.Set(context, dataTable);

@Mout_pessemier
Find a demo XAML here, that is showcasing some different conversions related to your scenario
Mout_pessemier.xaml (8.4 KB)

1 Like

and would this work?

1 Like

@Mout_pessemier
I cannot see all settings, but give a try and do debug it for more detail inspection