ข้ามไปเนื้อหา

ผลต่างระหว่างรุ่นของ "CuneiForm"

เพิ่มขึ้น 1,645 ไบต์ ,  8 เมษายน 2567
บรรทัดที่ 170: บรรทัดที่ 170:
The option to modify object-specific values after initiation is also available. However, since value packing and manipulation occurs during initiation, some details should be noted:
The option to modify object-specific values after initiation is also available. However, since value packing and manipulation occurs during initiation, some details should be noted:
* '''skipseqs''', '''skipcols''', '''firstonly''', and '''autorun''' are normal form attributes and can easily be accessed and modified.
* '''skipseqs''', '''skipcols''', '''firstonly''', and '''autorun''' are normal form attributes and can easily be accessed and modified.
* '''sptypes''' is distributed and packed as field attributes. We will follow-up on the example given under [[#Special Value Types]] section. After initiation, special value specification are thus set:
* '''instacalc''' are repacked as a dict upon initiation. The format and an example of post-init modification are shown below:
 
<syntaxhighlight lang="python">
form_obj.instacalc = {str trigger_fld0: [
                                          url_for_string route0,
                                          [str collect_fld00, str collect_fld01, ...],
                                          [str result_fld00, str result_fld01, ...]]),
                                          ...
                                        ]),
                      str trigger_fld1: [
                                          url_for_string route1,
                                          [str collect_fld10, str collect_fld11, ...],
                                          [str result_fld10, str result_fld11, ...]]),
                                          ...
                                        ]),
                      ...]
 
# Example from Product Return / Cancelled Order header form
head_form.instacalc["refdoc"]  = [
                                    url_for("cunei_iv.fetch_vouch_for_return", bookcode=bookcode),
                                    ["refdoc", "refdate", "docdate"],
                                    ["company_stid", "company_code", "company_name", ...]
                                ]
head_form.instacalc["refdate"] = [
                                    url_for("cunei_iv.fetch_vouch_for_return", bookcode=bookcode),
                                    ["refdoc", "refdate", "docdate"],
                                    ["company_stid", "company_code", "company_name", ...]]
</syntaxhighlight>
 
* '''sptypes''' is distributed and packed as field attributes. We will follow-up on the example given under [[#Special Value Types]] section. After initiation, special value specifications are thus set:


<syntaxhighlight lang="python">
<syntaxhighlight lang="python">