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 1372 0

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

admin 楼主

2018-8-1 13:37:47

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

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

x
8 C* x/ `  W( B$ }) K3 Y  L
" f, P- |+ ]5 y2 v$ q7 U. G/ x

. q7 m2 M0 e, D& ~1 P* U
' Q) X" q+ x. w
Technique  0 h: E( s7 ]  S/ }& p% ~7 I$ Q8 X$ \
There is no difference in setting up a query for a single Item or for many.  Only the
3 y- ?) y& W/ W! D) rcriteria define the set size returned.  In this recipe you create an Item and populate
( {- k) A7 ^6 l. Z' G, x& Ethe query criteria, apply it, and iterating over the Items returned producing a HTML % _3 R3 J1 U* o6 U$ ]
<TABLE>  fragment. 8 g, b, `0 ]3 d9 V

/ K, ^. o9 D" G  u$ A

/ e& a: ]  p. \- I- }JavaScript  
3 f% ]  r1 X( e# l. A" uvar qryItem = this.newItem("Part","get");
6 T$ A4 h% I) aqryItem.setAttribute("select","item_number,description,cost");
& o0 z8 o5 {8 x  |% kqryItem.setProperty("cost", "100", "gt");
$ V  n# F$ l5 L1 E5 mvar results = qryItem.apply(); 1 D; b0 }7 o* z! z
var count = results.getItemCount();
# a# m0 o6 U4 B2 ivar content = "<table>"; 6 w2 B7 b9 V. O9 [
for (var i=0; i<count; ++i) 4 v( a  S/ D/ n- p8 o6 x
{
, y8 N5 o( v! b5 O* A6 c+ d  var item = results.getItemByIndex(i);
8 Y! h; c3 _/ u3 u% E  content += "" + # W! J* U& q- V' Q( F
    "<tr>" +
2 n+ Y4 [# @, t$ l# ^) G# p1 V      "<td>" + item.getProperty("item_number") + "</td>" + 1 [3 }5 h  s9 \1 k! g8 R, U
      "<td>" + item.getProperty("description") + "</td>" + - M+ x5 F. H' U
      "<td>" + item.getProperty("cost") + "</td>" + . ?- v5 @0 W: r& }6 j$ R
    "</tr>"; . y8 `: S- e4 B( m! z' C' b5 X7 [
}   t/ t4 u" W2 s2 e. t$ \
content += "</table>"; + \' p$ N: Q8 \* U5 w' i% f+ V6 R
return content; 3 j3 C% z; i# G5 k# S

7 T& \7 w1 T. dC#  
3 n7 W9 t: w" ^2 _9 ^Item qryItem = this.newItem("Part","get"); ' g! |' w# [* A* O( L
qryItem.setAttribute("select","item_number,description,cost");
3 l  T1 z: d: J2 iqryItem.setProperty("cost", "100", "gt"); " W* E. K% l; ?% D8 V
Item results = qryItem.apply(); / g0 C4 d+ @: Z9 s5 a1 _1 L% c# ~
int count = results.getItemCount();
2 j/ h7 A: w4 l7 F& [int i; " e1 h. t2 }; u+ m
string content = "<table>";
! f, B. N) W$ G1 A6 sfor (i=0; i<count; ++i)
- r# a! K/ W( O0 a2 z# K5 p{ 7 l. J2 a6 ?; l% k7 O( M: m
  Item item = results.getItemByIndex(i); 8 k& ^: g; f) a8 y  f, A8 a" {
  content += "" +
6 k6 q" L+ L% o+ D9 I    "<tr>" + . b6 J! O  m$ J/ e2 d
      "<td>" + item.getProperty("item_number") + "</td>" +
( I+ W8 u- h. R- @      "<td>" + item.getProperty("description") + "</td>" +
; e9 w  f& w% [: Z: b: |8 X6 L      "<td>" + item.getProperty("cost") + "</td>" + 1 p4 ]1 d8 D; ], x  L
    "</tr>";
. n4 W- N$ Z3 X} , }3 A! {3 a0 v2 J3 O' d* u; t
content += "</table>";
7 {4 G& u0 p  zInnovator innovator = this.newInnovator();
6 R( q) O$ ?1 U% f- f+ dreturn innovator.newResult(content); % Q3 D; F" m( y( S
9 n& e. I- L* W9 o  L
VB.Net  ) |( D" H5 l: H
Dim qryItem As Item = Me.NewItem("Part","get")
5 ?; s9 X* |- @qryItem.SetAttribute("select","item_number,description,cost")
8 }1 E% F/ R6 w; @4 TqryItem.SetProperty("cost", "100", "gt") 1 B6 N7 Q3 O0 i6 n
Dim results As Item = qryItem.Apply()
2 |) c7 ~& S  }7 |: a; Z0 oDim count As Integer = results.GetItemCount()
) \% f: o. ?/ F4 O) l4 ^! R; n6 r* YDim i As Integer 6 O; X% Y: B4 k/ t" e6 [3 [. w
Dim content As String = "<table>"
$ i. x) M6 Q. e% p; k2 cFor i=0 to count - 1 ; D! y5 B. w. @: J. {
  Dim item As Item = results.GetItemByIndex(i)
0 C, b$ o- K) p# c  content += "" + _
+ G9 E$ r* K' I* u, K  L    "<tr>" + _
; u2 T) u( `1 C5 y      "<td>" + item.GetProperty("item_number") + "</td>" + _
% @, H. i" U! w2 k2 d* C      "<td>" + item.GetProperty("description") + "</td>" + _ 4 T/ h7 y/ F5 c# M
      "<td>" + item.GetProperty("cost") + "</td>" + _
0 r: o2 T/ V" w    "</tr>" $ F% l+ X/ ?5 \
Next
+ J6 ~5 y/ c  o! Kcontent += "</table>" / ~7 a2 J* i7 j' H% b2 Y* `

" _3 _$ x+ ^6 r7 W1 SDim innovator As Innovator = Me.NewInnovator() # v# \# l" J/ ^: O9 f9 t
return innovator.NewResult(content)
1 }' v; {. [' O! E% Y# e6 M+ \2 f7 `. g! G* `* [8 T. N. ]

2 m( J$ w' A9 g2 s; l9 D/ Q, ^3 U7 m
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了