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

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

admin 楼主

2018-8-1 13:37:47

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

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

x

5 p  m- a7 ?& N- p; |) @+ P2 o& k7 z5 d/ C6 i

6 {5 c* q+ q8 ]8 k4 o, _
8 z3 L( [0 Q: m4 G6 {
Technique  
1 x) ?, t  f7 l1 L: PThere is no difference in setting up a query for a single Item or for many.  Only the
' W# B( W2 ^  ?- x0 V& v" D9 icriteria define the set size returned.  In this recipe you create an Item and populate
3 V  |4 b0 O" f( uthe query criteria, apply it, and iterating over the Items returned producing a HTML
! K0 s- m! [( A8 g& T<TABLE>  fragment.
3 ]! o+ U0 V4 m5 |- f) E0 ~7 a+ z3 W/ ~0 n

% @# s9 E- k- ~. A7 sJavaScript  $ q2 n; z# ~+ g1 F  Q, K5 n
var qryItem = this.newItem("Part","get"); / g5 g7 B  H% \) S0 D
qryItem.setAttribute("select","item_number,description,cost"); 8 j* Z3 E2 H" M2 S) ^8 a! F
qryItem.setProperty("cost", "100", "gt"); ! Q; a- t/ Z6 B: W0 _; G5 B
var results = qryItem.apply(); & u. b1 y9 j4 {4 f9 k
var count = results.getItemCount(); 0 X4 Q$ k" t$ `4 C# u+ n1 J7 e9 Z
var content = "<table>"; 2 Q  ]+ n, D) m% i5 T8 z- h' W
for (var i=0; i<count; ++i) % ?) R: N/ g( x3 f3 p
{
' s! f7 P6 ?% B3 ~4 p0 X! y  var item = results.getItemByIndex(i); : m# V3 `& N5 ~4 m3 g6 r- K* w
  content += "" + # \& j) J# I6 F! t
    "<tr>" +
6 q7 h5 V) M9 O. {* V      "<td>" + item.getProperty("item_number") + "</td>" +
4 L8 [; ?' R% V" G      "<td>" + item.getProperty("description") + "</td>" +
; o7 ~5 S2 Q4 F3 F. L      "<td>" + item.getProperty("cost") + "</td>" + % D1 ]2 d7 v0 j7 Q
    "</tr>";
: v2 O- C8 B' c/ o3 M( P+ s} " \1 B" p% {% f; p9 @: X9 ]
content += "</table>"; 0 n  e' A3 ]% W9 z* ^0 d( e5 d# F
return content; , n7 O/ H  n2 d- g8 R) L# S0 v
' x8 T7 J2 e5 `  M7 y# u' b. C
C#  
- r* m% d# o. qItem qryItem = this.newItem("Part","get");
. C  g  q; M5 r7 }, [% W3 s9 LqryItem.setAttribute("select","item_number,description,cost"); ) s/ s$ p% w0 D3 J" M
qryItem.setProperty("cost", "100", "gt");
! p0 {( h" e- }Item results = qryItem.apply(); - |5 o! l( _/ B- E& |) ]" G3 ~. K
int count = results.getItemCount(); 3 B, \$ M. L! j' S# Z; g0 J
int i;
! K$ Q0 o4 P9 i! v3 astring content = "<table>"; / ^+ m" f1 d2 Y; e' w+ F1 |
for (i=0; i<count; ++i) - ?( Q4 H9 t3 D! d
{
7 W1 C4 B- r2 Y1 L  Item item = results.getItemByIndex(i); ( o  S8 q; E& e5 u) n' D$ @+ ^
  content += "" + 6 B. Q; X$ e# n! G; D- j
    "<tr>" +
3 f& r& a# M! b( c6 r7 E3 N1 ?1 @/ C      "<td>" + item.getProperty("item_number") + "</td>" + , V) S& K$ w1 q6 D8 p
      "<td>" + item.getProperty("description") + "</td>" + 6 Y- K' U' m0 o+ F% |' H
      "<td>" + item.getProperty("cost") + "</td>" +
1 W8 C1 H4 \7 X9 G    "</tr>"; 2 Y& Z) T5 D& c4 Z! X
}
/ t, L( Z3 Y) f, Econtent += "</table>"; ; K+ \2 w( S5 L
Innovator innovator = this.newInnovator(); ! m. ^8 y+ M+ Y, S" h
return innovator.newResult(content); 7 L- V% B8 ^  x1 L# |7 k. b( E
8 [% g+ M) J7 A+ K( F
VB.Net  
; q; I+ Q, F4 ]* T7 LDim qryItem As Item = Me.NewItem("Part","get")
& W& `& z' F" v; _% M- |qryItem.SetAttribute("select","item_number,description,cost")
7 }" d8 O& _' H+ J1 ]3 xqryItem.SetProperty("cost", "100", "gt")
5 p9 f( I( o) x0 hDim results As Item = qryItem.Apply()
+ x- x5 Y' }  EDim count As Integer = results.GetItemCount()
8 p" E1 h; ~3 e6 Q, WDim i As Integer
% C. S; g6 C6 I" H3 q3 m3 r& qDim content As String = "<table>"
: J, k& w2 C0 \+ M8 N" gFor i=0 to count - 1 6 M* q9 f3 F( k% E7 m1 B
  Dim item As Item = results.GetItemByIndex(i) ! S8 T6 H$ ~5 C& }2 b* c
  content += "" + _
( b# T& Q* f, S* _0 R' H1 q, o  o    "<tr>" + _ 4 u5 C; C5 |8 X/ Z' M3 y  u
      "<td>" + item.GetProperty("item_number") + "</td>" + _ 9 s, F; f: U: @/ S& X# h: W& |( L
      "<td>" + item.GetProperty("description") + "</td>" + _
/ M/ h1 _6 k; _" F) X+ I9 C      "<td>" + item.GetProperty("cost") + "</td>" + _ # i7 q8 b' i! ?; M
    "</tr>" 1 U6 o! e8 ^# @! Q
Next
; E- X7 }/ Q6 P' ucontent += "</table>"
9 `( s. G" L- r
. `7 n7 x- S$ I0 lDim innovator As Innovator = Me.NewInnovator() & v1 W8 X7 \; v( `
return innovator.NewResult(content) : U  p- x" {: H2 s- e6 e5 O

/ F( e: h. m0 _- {3 f
/ W$ t2 f0 c' X! A
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了