Populating certain row in table with certain data

0
jackski posted this 16 November 2014

Hi, i have the following table: enter image description here

I want to write the X dynamically according to some preference in one of the table rows. For example I have an C# dictionary with the mapping c -> X in this document and b -> X in another.

How can I achieve this with Docentric?

Thanks, Jack

Last edited 16 November 2014

4 Posts
4 Points
3 Comments
Order By: Standard | Newest | Votes
0
jles posted this 16 November 2014

Hi Jack,

Docentric Toolkit doesn't have yet the ability to write arbitrary expressions/formulas in templates that you can find in some other reporting toolkits. So you are limited to simple data bindings (binding paths expressions). This means that you need your data sources to have a suitable structure/schema so that you can data bind template elements against the schema.

If I correctly understand you, you managed to render a collection of some objects (in the form of a table), but you can only render "title" for each row and not another value because it is not part of the record/row object/class. You have 2 options here:

  • Extend your record class by adding additional property to the class (that already has the "title" property) and fill its value in your .NET application - you will be able to data bind directly the FIELD element to this new property.
  • Name the FIELD element in the second column (inside the wrapping LIST element) and use the "ElementInitialize" event to provide the value for this FIELD on the fly, in your code at document generation time.

Please let me know if this helped you or you need additional explanation.

Best regards, Jurij

Last edited 16 November 2014

119 Posts
246 Points
0
jackski posted this 17 November 2014

Hi, Thanks for the response.

I am afraid that I haven't clarified enough. I have the above table hard coded in my template/document. According to the generated document I have to "check" one of the rows, either "a" or "b" or "c" or "d". I.e. in the table above I have "checked" "c" because this is a document of type "c".

During run time, I can determine what type of document I am working with, and the ideal option is to send a string with the value "X" to Docentric (if not possible I will create an object, but it is less desired), so that it can be incorporated in only one of the rows.

I am looking for the best way to achieve this.

Best regards, Jack

4 Posts
4 Points
0
jles posted this 17 November 2014

Jack, I think I got. What you want to do is rendering an "X" mark in the correct table row/cell according to the actual document type. Document type is the information/data that you know/provide at document generation time. Well, if this is the case, you can easily achieve this with IF elements. Put an IF element in each of the right cells where each of the IF elements would contain "X". As you might already know, the IF element includes or excludes its wrapped content (in this case "X") in regard to its (boolean) value. So, if you want to easily data bind all four IF elements in your template, you will need to create a class with four properties (IsDocumentTypeA, IsDocumentTypeB...), and at document generation time you will need to instantiate/initialize it and pass it as the data source value. If you don't wan't to create a class, you can just name these IF elements and provide values for them in a ElementInitialize event handler on-the-fly.

Let me know if this makes sense.

-- Jure

119 Posts
246 Points

Our 30758 members have posted 271 times in 80 discussions