Advanced Post-Search Relations Help

  • 119 Views
  • Last Post 16 February 2020
ElliotG posted this 07 January 2020

Hi Everyone,

I want to add a piece of code in the advanced post-search relations that does the following.

If the field in the RG IsNull, fill in the information with the instance above it.  This is what I have so far but I am afraid I'm not coding it correctly/understanding the field.

if Regular.PageGroup1.Fields.Consumption.CurrentInstance.StartDate.IsNull then

{

Regular.PageGroup1.Fields.Consumption.CurrentInstance.StartDate.Value = Regular.PageGroup1.Fields.Consumption.Instance(1).StartDate.Value;

 

}

I'm getting an error "Left operand of '=' must be changeable"

Any help would be awesome!! thanks!!


Order By: Standard | Newest | Votes
hawkeye69 posted this 09 January 2020

Alright, so I think you are in FlexiLayout Studio, yes? As a general guideline these kinds of operations are better suited for Project Setup, not FLS. You would perform this operation in the project, after recognition has executed. As I hint, I think you would want to add a Workflow script stage using an advanced workflow. You can perform editing logic there, especially if you end up doing something like adding an instance to a repeating group. I hope this gets you started in the right direction.

Adrian

ElliotG posted this 20 January 2020

Thanks Adrian,

Yes I was working in FLS.  You are correct this would work better in the Doc Def.  I have been able to add a lot scripts to help with normalization, autopopulate fields based on other fields, etc, but have not been able to do so with tables (RG's).  Is there is an example script somewhere (using C#)?.  I've been looking around here:

https://help.abbyy.com/en-us/flexicapture/12/developer/irulecontext
https://help.abbyy.com/en-us/flexicapture/12/developer/idataset

But haven't been able to execute properly yet.

Thanks!
Elliot

Dusan posted this 09 February 2020

Hi,

There is a difference between table element and repeatable group and that is i think your problem...

When you want to access table item then you have to use IField.Items property which represents Instances of the field (rows of table fields).

https://help.abbyy.com/en-us/flexicapture/12/developer/ifield

 

Sincerely,

Dusan

ElliotG posted this 16 February 2020

Thanks,

I have been trying different ways to get this information but have had no luck.. :/

My basic function is to loop through the table like so:

var total = 0;

//here is where I want to loop through every row in the RG/table in DocDef and add up all the lines under column "TotalPriceNetto" in table "LineItems"

foreach (char value in Context.Field("TotalPriceNetto").Text) 

{

    var newtotal = total + value;

 

}

 

Context.Field("SumofLineItems").Value = newtotal;


The only thing is I can't figure out how to reference the table/RG and it's column correctly.

In C#, how would I go about this?  I've tried many different objects like Context.DataSet, Context.Field.Items, etc etc but I can't get it working..

Any help would be awesome!!

Close