Datasets execution order


Let's say I need to create a report from two datasets: ListA and ListB ( no master-details ). What's more,  ListB relies on  some data from ListA ( the data is located on fixed cells ) .  How can I be sure that Flexcel process ListA data first, so ListB can get the data?

Hi,


The order of execution of datasets is not defined, and in fact it has changed in the lifetime of FlexCel. FlexCel used to start from the last range then go to the top, but when we added the ability to use IEnumerables, we had to adopt a forward order so we can call IEnumerator.Next. In the future, it might even be in parallel: ListA could be filled at the same time as ListB.

So in short, you can't rely in any order, even if today you find an specific order. The whole idea is that if the datasets are not master detail then they should be independent one of the other and FlexCel is free to optimize the best path.

If you can explain me a little more how is that ListB depends in ListA, I might figure out what can be done. If ListA and ListB are not in master detail, then how is listB related to ListA? Do they have a single record or multiple records?

Hi Ardian,

Thanks for the response.

The report I'm creating should show ListB data and calculate/format some of its cells using data from ListA.
ListA is not a dataset in nature, but I use it as a dataset with one element to be able to use <#ListA.Property> and <#ListA.Property.AnotherProperty> syntax.
More about this problem here.

Because of the inner properties I can't use "SetValue" method to create report variables or <#dbvalue> to get data without using a named range.
In any case do cells with SetValue-variables or <#dbvalue> processed before datasets?

In general I <#evaluate(something)> in ListA and want to used them in ListB.
What I actually get in ListB is not an evaluated value, but "<#evaluate(something)>" string.

Hi,

Thanks for the extra info, and sorry about not being able to look into the original problem: I've bumped it into the priority list to see if I can get some time to implement it.

Now, about this question: As the order is not defined (And as said, it might even be in parallel some day), you can't sadly access cells from other cells: You don't know if the original cell was filled yet.

What you should do is to define an expression with the value you want. Say, define in the config sheet:
MySomething = <#evaluate(something)>


Then in ListA write <#MiSomething> and in ListB use <#MySomething> too. So you write the expression once in the config sheet, and use it in both sides. The only thing is that ListB must be inside the lista range, but that shouldn't be a problem since this aren't real datasets.

But in general, you should not count in a defined order in how the cells are filled, and you should not use values of calculate cells into other expressions: just use expressions in the config sheet.
I understand that I need to make __lista__ range bigger, so it inludes __listb__. That way I can use ListA data.

I tried it and it works fine, but there are another problem as my report a little bit more complicated.

To not to dive deeply to our domain terminology let's create a synthetic sample.

Define data ( I will use some kind of c# pseudo code ):

class CheckPoint {
  string id;
  string time; 
}

class PersonStat {
  string name;
  List<CheckPoint> CheckPoints;
}

PersonStats = List<PersonStat> 
FirstPersonStat = PersonStat.First()

Every person runs the same route, so the checkpoint's count are the same and checkpoints ids are the same (consequentially). 

The result table should look like this.

As you can see the table's header is horizontally dynamic. To expand it I use <#FirstPersonStat.CheckPoints>.
As both <#FirstPersonStat> and <#PersonStats> contains CheckPoints, I can't use the same named range "I_CheckPoints_I" for both.
So that's the first problem, which I solved by adding 

List<CheckPoint> CheckPoints2 { get { return CheckPoints; }} 

to PersonStat class.
Is there any other solution for that?

Please see the named ranges in sample.xlsx file to understand my current layout.

If I create a bigger __FirstPersonStat__ named range. Both <#CheckPoints.id> and <#CheckPoints2.time> will use check points from <#FirstPersonStat>.
Is there a way to give Flexel a cur from where to get CheckPoints?