I am writing a report containing a table with objects. I would like the order of the objects to be the same as the order seen in the System Weaver main window where the objects are located.
I have used the command ForEach with the addition OrderBy(Name). But that of course only sorts by name. Are there other sorting orders?
Thank you!
最佳答案
S
SystemWeaver
说
将近7年 以前
You can use <ForEach> and get the part number ordering if traversing in two steps.
First get the parts and order by the part ordering e.g.,
<ForEach select="/part::SID.OrderBy(PartNo)"> ...
This will give you a list of parts with the same ordering as in the tree. You need to operate on parts to be able to sort on the part number ordering. From here you can get the items by using either:
The printout will be according to the order you have in the structure, which is the partnumber order.
Regards, Peter
SystemWeaver
说
将近7年 以前
Hi Johan,
To get a part number ordering when you use context you need to use the <ContextGoYY> tags. When not using context the <ForEachPart><DefObj> tags use the part number ordering as default.
The <ForEach> tags do not use the part number ordering. The path language that is used with the <ForEach> tags operate on sets of items. This means that you loose the parts during the evaluations which means that you do not have access to the part ordering.
So to get the same ordering as in the tree do not use <ForEach>.
Best regards
Martin
SystemWeaver
说
将近7年 以前
回答
You can use <ForEach> and get the part number ordering if traversing in two steps.
First get the parts and order by the part ordering e.g.,
<ForEach select="/part::SID.OrderBy(PartNo)"> ...
This will give you a list of parts with the same ordering as in the tree. You need to operate on parts to be able to sort on the part number ordering. From here you can get the items by using either:
<DefObj> or <ForEach select="/defobj::">
Best regards
Martin
J
Johan Wiberg
说
将近7年 以前
Thank you for your answers!
I tried the two-step approach with <ForEach> but with no success.
Thereafter I used the <ForEachPart> and <DefObj> and that worked as intended for me.
Johan Wiberg
I am writing a report containing a table with objects. I would like the order of the objects to be the same as the order seen in the System Weaver main window where the objects are located.
I have used the command ForEach with the addition OrderBy(Name). But that of course only sorts by name. Are there other sorting orders?
Thank you!
You can use <ForEach> and get the part number ordering if traversing in two steps.
First get the parts and order by the part ordering e.g.,
<ForEach select="/part::SID.OrderBy(PartNo)"> ...
This will give you a list of parts with the same ordering as in the tree. You need to operate on parts to be able to sort on the part number ordering. From here you can get the items by using either:
<DefObj> or <ForEach select="/defobj::">
Best regards
Martin
- 最早在前
- 热门
- 最新在前
Sorted by 最早在前Peter Lydh
Hi Johan.
You can use OrderBy(PartNo).
The printout will be according to the order you have in the structure, which is the partnumber order.
Regards, Peter
SystemWeaver
Hi Johan,
To get a part number ordering when you use context you need to use the <ContextGoYY> tags. When not using context the <ForEachPart><DefObj> tags use the part number ordering as default.
The <ForEach> tags do not use the part number ordering. The path language that is used with the <ForEach> tags operate on sets of items. This means that you loose the parts during the evaluations which means that you do not have access to the part ordering.
So to get the same ordering as in the tree do not use <ForEach>.
Best regards
Martin
SystemWeaver
You can use <ForEach> and get the part number ordering if traversing in two steps.
First get the parts and order by the part ordering e.g.,
<ForEach select="/part::SID.OrderBy(PartNo)"> ...
This will give you a list of parts with the same ordering as in the tree. You need to operate on parts to be able to sort on the part number ordering. From here you can get the items by using either:
<DefObj> or <ForEach select="/defobj::">
Best regards
Martin
Johan Wiberg
Thank you for your answers!
I tried the two-step approach with <ForEach> but with no success.
Thereafter I used the <ForEachPart> and <DefObj> and that worked as intended for me.
Thank you for your support!
/Johan
-
Comparing two versions of a structure
-
Context and path language
-
Overview of meta model
-
Importing old data
-
Cannot find multiple version items
-
Accumulated bar chart
-
Cannot remove part - is referenced
-
View of non accessable data
-
Path: How to check if an attribute is empty?
-
List and path language
查看所有33话题