Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide sample for custom forms with supervised table #20547

Closed
maririos opened this issue Apr 20, 2021 · 1 comment · Fixed by #20840
Closed

Provide sample for custom forms with supervised table #20547

maririos opened this issue Apr 20, 2021 · 1 comment · Fixed by #20840
Assignees
Labels
blocking-release Blocks release Client This issue points to a problem in the data-plane of the library. Cognitive - Form Recognizer
Milestone

Comments

@maririos
Copy link
Member

For custom form samples that use sample forms that have tables, demonstrate iterating through tables and printing data.
Probably only include cell location and text to not overwhelm the output.

Need to get training data for it.

@maririos maririos added blocking-release Blocks release Client This issue points to a problem in the data-plane of the library. Cognitive - Form Recognizer labels Apr 20, 2021
@maririos maririos added this to the [2021] May milestone Apr 20, 2021
@maririos
Copy link
Member Author

An example could be:

                foreach (FormField field in form.Fields.Values)
                {
                    Console.WriteLine($"Field '{field.Name}': ");
                    if (field.Value.ValueType == FieldValueType.Dictionary)
                    {
                        var table = field.Value.AsDictionary();
                        //columns
                        foreach (var col in table.Values)
                        {
                            Console.WriteLine($"Column {col.Name}");
                            if (col.Value.ValueType == FieldValueType.Dictionary)
                            {
                                var row = col.Value.AsDictionary();
                                foreach (var rowValues in row)
                                {
                                    Console.WriteLine($"Row {rowValues.Key}");
                                    if (rowValues.Value != null)
                                    {
                                        var rowContent = rowValues.Value;
                                        if (rowContent.Value.ValueType == FieldValueType.String)
                                        {
                                            Console.WriteLine($"  '{rowContent.Value.AsString()}'");
                                        }
                                    }
                                    else
                                    {
                                        Console.WriteLine("  Empty cell");
                                    }
                                }
                            }
                        }
                    }
                }

It should be prettier, but this gives an idea

@maririos maririos self-assigned this May 3, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocking-release Blocks release Client This issue points to a problem in the data-plane of the library. Cognitive - Form Recognizer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant