PLM之家精品课程培训,联系电话:18301858168 QQ: 939801026

  • NX二次开培训

    NX二次开培训

    适合初级入门或想深入了解二次开发的工程师,本培训结合ufun,NXOpen C++,大量的实例及官方内部的开发技术对于老鸟也值得借鉴!.

    NX CAM二次开发培训报名 NX二次开发基础培训报名
  • PLM之家Catia CAA二次开发培训

    Catia二次开发培训

    Catia二次开发的市场大,这方面开发人才少,难度大。所以只要你掌握了开发,那么潜力巨大,随着时间的积累,你必将有所用武之地!

  • PLM之Teamcenter最佳学习方案

    Teamcenter培训

    用户应用基础培训,管理员基础培训,管理员高级培训,二次开发培训应有尽有,只要你感兴趣肯学习,专业多年经验大师级打造!

  • PLM之Tecnomatix制造领域培训

    Tecnomatix培训

    想了解制造领域数字化吗?想了解工厂,生产线设计吗?数字化双胞胎,工业4.0吗?我们的课程虚位以待!

PLM之家PLMHome-国产软件践行者

【Aras二次开发】查询和迭代查找item集

[复制链接]

2018-8-1 13:37:47 1215 0

admin 发表于 2018-8-1 13:37:47 |阅读模式

admin 楼主

2018-8-1 13:37:47

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x
4 s! g7 h: i/ E) D# H: \, i' k

4 F% d9 Z& }9 n4 M& L5 l/ k! m/ E! P/ O
" @8 A8 d( m# ~/ m3 T: ?8 o
) y9 Q4 H: ~) Y" J
Technique  
& o1 \5 Q4 b* G7 bThere is no difference in setting up a query for a single Item or for many.  Only the
  \3 t7 |; F0 R  y) U6 Qcriteria define the set size returned.  In this recipe you create an Item and populate # p& t2 n5 L" Z. r/ x
the query criteria, apply it, and iterating over the Items returned producing a HTML / H" m6 N% B/ B/ R* y
<TABLE>  fragment.
- V1 b  ?% u, L! R/ {
. l# A2 W, b$ I/ D' l1 q8 L/ a; r
4 l1 j; R8 Z. |5 U
JavaScript  / D7 Q2 p9 ?& z: N) F1 \
var qryItem = this.newItem("Part","get");
; x. G1 D6 E: \; F' A6 sqryItem.setAttribute("select","item_number,description,cost"); " W  `; Z+ ]5 }; m2 B5 L
qryItem.setProperty("cost", "100", "gt"); , u+ s5 J2 @3 w; U7 C" H7 l
var results = qryItem.apply(); # }: q% u4 J. \6 R
var count = results.getItemCount();
- U3 ~9 d1 \" ^7 b6 r- rvar content = "<table>";
$ x: @# X1 n4 s% y4 @3 efor (var i=0; i<count; ++i) , i$ t  D- M6 P  H
{ & E+ W8 ~0 v8 }$ R: M6 ~
  var item = results.getItemByIndex(i);
: \# p5 p& e. R% n* }  content += "" + 4 K8 O0 w" s6 h2 D0 u8 v% S- q8 p
    "<tr>" + * E' z  @% B- r
      "<td>" + item.getProperty("item_number") + "</td>" + 4 Y" I, \7 L; ^2 v
      "<td>" + item.getProperty("description") + "</td>" +
  q7 ^9 C4 H! p% Y2 S      "<td>" + item.getProperty("cost") + "</td>" +
2 O% q5 _  R! j' G* _' H5 G! L9 X    "</tr>"; * b' Q8 ]. v1 b! v
} # p3 E  w8 ~$ w3 L' R2 W4 g; `) |
content += "</table>";
+ f6 [1 U0 ?1 o' E0 ureturn content; " b2 u( N7 ]) w& _6 t" M/ r

! I, K3 t" ^/ j6 G1 _C#  $ [1 G! K- j" E- h0 d
Item qryItem = this.newItem("Part","get"); 6 x. k, u3 f( c" R; g
qryItem.setAttribute("select","item_number,description,cost"); - v5 _( A# ~0 v5 [+ {
qryItem.setProperty("cost", "100", "gt"); 4 l" f$ }% I( S/ c* A; m
Item results = qryItem.apply();
) j0 }9 q" t+ K% q, q$ t7 M4 bint count = results.getItemCount(); 6 s3 n- N7 i( q9 l" v& O! s
int i;
; \" T9 O& X* O% ^string content = "<table>";
. j6 S4 n4 k7 ~9 afor (i=0; i<count; ++i)
& r( A* n: S. s1 T9 s{ " d6 v( {; K/ N6 k# P
  Item item = results.getItemByIndex(i); " G. q- w) B9 {) G/ A% u
  content += "" + / ~; C8 L9 ~. {! Y; X0 F/ T
    "<tr>" +
0 K% ~) @9 p6 B/ D5 N, j  I$ ?! x      "<td>" + item.getProperty("item_number") + "</td>" + + @! Z; r$ Q2 C8 J8 \
      "<td>" + item.getProperty("description") + "</td>" + 4 |5 l5 R# M; A9 T! G, @
      "<td>" + item.getProperty("cost") + "</td>" +
$ _% x' R4 E. [8 M$ g# P6 l: L2 K    "</tr>"; # n7 \, b% U6 X) q: k
}
* S5 o; e1 G, c3 w4 Wcontent += "</table>";
' J5 N9 X8 `6 H. V; O6 l4 EInnovator innovator = this.newInnovator(); " ^/ m* S1 j3 a
return innovator.newResult(content); 8 A0 E. ?" e* T7 l

# _, m) G9 F' I; I3 X, ?, g! ~7 }" QVB.Net  
# Z. ~, @5 q/ Y! a. E, p* o1 }Dim qryItem As Item = Me.NewItem("Part","get")
9 g* p4 V, n% b% fqryItem.SetAttribute("select","item_number,description,cost") / L% s+ Z, P8 I5 V( v5 L" ^
qryItem.SetProperty("cost", "100", "gt")
$ s; m- q6 J# ~5 Y5 r; }0 e7 PDim results As Item = qryItem.Apply() / t( e! f+ T" K$ {9 p
Dim count As Integer = results.GetItemCount()
5 y: u, w3 \+ S% E9 }( PDim i As Integer , W$ M; m+ U+ G6 Z) K! V/ c
Dim content As String = "<table>" + y* `* O8 [, \+ G& c; |- c
For i=0 to count - 1
8 _' _3 H9 `; I" F* a  Dim item As Item = results.GetItemByIndex(i)
! ?* |  n' \! O$ w$ ~1 U0 f  content += "" + _ 0 N# m; D1 k$ N: h6 P
    "<tr>" + _ ( c( I' K0 |3 _6 [( M& e% ]0 o
      "<td>" + item.GetProperty("item_number") + "</td>" + _ : h* |2 ^3 ]! [" P
      "<td>" + item.GetProperty("description") + "</td>" + _
: N3 O" T3 p5 q4 {1 Z8 K/ e      "<td>" + item.GetProperty("cost") + "</td>" + _
: o$ _! _1 p: z3 Z* H& @    "</tr>" $ T5 u4 d9 j# R
Next
5 g5 }' k0 T: A- Ccontent += "</table>" + G% m# X9 {3 {2 a3 A* p" J. J
' a1 D! g5 {6 Z7 k
Dim innovator As Innovator = Me.NewInnovator() $ C" W# P8 i9 ~3 L2 B
return innovator.NewResult(content)
8 t7 H9 j4 Y" S$ o& d, E& Z6 |& F; l' T2 X

* S7 \* f+ c* j$ J5 r4 R  \
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了