コミュニティ

Adding rows to a table in a rule script

Is it possible to add rows to a table field in a field rule script?.
I need to perform a table search based on a field value and get all rows of the database table into a document table.
It's been pretty easy to query a database and get a recordset, but i have not been able to copy records to the table.
Thanks for any help you can provide.

この記事は役に立ちましたか?

0人中0人がこの記事が役に立ったと言っています

コメント

8件のコメント

  • Avatar
    Aleksei Nikitin
    Hello atorino,

    How common is the case when the scipt should be re-checked on verification?
    How long does the query execution take?
    0
  • Avatar
    Alberto Torino
    Normally it should run once per document. When a certain field (id) contains a value it should run and query a table and bring some records with the same id. The query is fast. I know that Flexicapture runs many times the script by itself, but i can make it run depending on another field in order to make it run just once.
    The problema is that there is not Table.Rows.AddNew that can be used to add new rows to the table, at least as far as i know.
    0
  • Avatar
    Aleksei Nikitin
    You can add rows with IField.Items.AddNew method. Some difficulty is in unavailability for script rules.
    However you can
    * either use "On open document" event for verification stage
    * or "After document state changed" event handler with checking recognition state

    For your case they are almost the same.
    0
  • Avatar
    Alberto Torino
    Thanks Aleks. But i need to add rows after a field is complete which can be recognized (in that case it would work) or it can also be entered by the operator at verification stage, and that's the situation i want to deal with.
    0
  • Avatar
    Aleksei Nikitin
    How about to use custom interface button?
    Rows adding will not be automatical in full but you will be able to add any rows number with one click and then perform other actions in script if needed.
    0
  • Avatar
    Alberto Torino
    Dear Aleks:
    If you mean a custom action, i can run a query to return the records i need, but as you've mentioned before, the IField.Items.AddNew is not available at rules. so there is no way to insert those rows in the table.
    0
  • Avatar
    Aleksei Nikitin
    I meant stage tools in project properties: "On User Command" event + add button in skin setings.
    0
  • Avatar
    Alberto Torino
    I see. Nice workaround , It should work as long as IField.Items.AddNew is allowed. Thanks
    0

サインインしてコメントを残してください。