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

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

admin 楼主

2018-8-1 13:37:47

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

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

x

! M8 z  ?$ u* v! d
+ h  _3 B% ~3 `9 D* E
/ A( v0 d0 w* \' d) C. s7 j

3 a* _5 t% j+ R! d4 y  ~$ {6 Z* tTechnique  
2 ?! }# _3 G3 z3 pThere is no difference in setting up a query for a single Item or for many.  Only the
0 K+ w! Z1 X: j( N" |criteria define the set size returned.  In this recipe you create an Item and populate
2 }+ L5 ?1 {6 f  {the query criteria, apply it, and iterating over the Items returned producing a HTML / b, w1 }( r5 d9 F
<TABLE>  fragment. ) `8 t- [  ~+ |6 s
; V4 |& i" C4 ^; z

# s' I! P+ O% \. B/ w) u& xJavaScript  1 ~0 q1 L! l& P
var qryItem = this.newItem("Part","get");
4 n. m( g8 ^5 }8 T1 kqryItem.setAttribute("select","item_number,description,cost");
5 J2 p7 K5 i' T) n/ L  C7 U' r$ W) xqryItem.setProperty("cost", "100", "gt");
5 l& `( I7 M) n5 F& yvar results = qryItem.apply();
: p  P/ F3 ^  ]4 t8 ^, m0 hvar count = results.getItemCount();
9 S# j& P  ^0 ?' evar content = "<table>";
. c: }1 Q9 ]; m9 A% T- Q" S4 ^* J- D6 pfor (var i=0; i<count; ++i) 5 Q/ g; c2 I9 D2 Z$ h8 O' {
{
7 O1 n+ m) o5 b' l' ?# b  var item = results.getItemByIndex(i); , ], f3 J9 Y7 y9 }
  content += "" + - ?4 ^% H/ s/ Z' h& s" z6 a' c8 n& }
    "<tr>" +
6 e+ I& g3 U' `3 B. }+ o; h1 w6 w  }      "<td>" + item.getProperty("item_number") + "</td>" +
8 L- W7 O0 s: p. z# c# l5 _1 Z/ I      "<td>" + item.getProperty("description") + "</td>" + " r& n9 s/ g+ R* H/ T3 x7 Z- Q
      "<td>" + item.getProperty("cost") + "</td>" +
8 O9 u0 K% d" a; ^    "</tr>"; 4 j: h3 D; X) v) k
}
# ~; p- |/ H: h" Y0 F& A" icontent += "</table>"; 9 E+ g7 I. ^6 S
return content;
, m3 N8 ?2 ?% g% t8 L0 W/ u9 ^0 u
* b$ Q# s" Z5 ]% C' s5 g9 JC#  0 E- L" D: S( @" G8 ]0 D
Item qryItem = this.newItem("Part","get");
) h8 f$ `7 a/ m/ N) o! s- u% e( z3 CqryItem.setAttribute("select","item_number,description,cost");
8 q5 s; v, i* pqryItem.setProperty("cost", "100", "gt");
( _& \7 i& d, R7 v3 sItem results = qryItem.apply();
0 F3 {" C8 j7 O* E9 K+ mint count = results.getItemCount(); 7 s$ C- @+ R: D4 Z- \' C0 N2 z
int i;
& x$ K' i  H+ @1 Q+ V( wstring content = "<table>";
+ N+ S* P- H. Q; n8 x$ h% M7 Rfor (i=0; i<count; ++i)
. ?" m+ W5 \3 `{
- n3 A) Z! X( `0 Q6 H# g8 p  Item item = results.getItemByIndex(i);
3 }: ?: f1 {7 H  content += "" + ( z. O4 `) M7 ]& X  d
    "<tr>" + 9 h/ b3 c7 L2 [4 W
      "<td>" + item.getProperty("item_number") + "</td>" + 4 T4 \6 K3 {* W5 V7 @; M* f
      "<td>" + item.getProperty("description") + "</td>" +
0 Y0 E" c/ {* A+ K$ R2 m3 U* M! T      "<td>" + item.getProperty("cost") + "</td>" +
/ n9 a' Y" Q' Q- b  |    "</tr>"; 0 ^1 Q9 f4 Y( Z" k
}
' u0 _+ h) n) B) Z* I1 kcontent += "</table>"; ( g# H- i& u9 S  C! i
Innovator innovator = this.newInnovator();
/ D$ p/ `$ q% M* Nreturn innovator.newResult(content);
  p/ b" c/ ?/ Q# F0 v
) c$ N7 m- v) }: q) g; t1 j8 J9 iVB.Net  ) k$ f$ a! s( w3 |, }9 C0 {
Dim qryItem As Item = Me.NewItem("Part","get")
% H! `! P: r2 [8 {+ v& F, M. H3 W% UqryItem.SetAttribute("select","item_number,description,cost")
- T: Q3 k4 V& D/ eqryItem.SetProperty("cost", "100", "gt") 2 A) j+ E( W6 g; z; N
Dim results As Item = qryItem.Apply()
3 t1 y4 Z7 S- HDim count As Integer = results.GetItemCount()
2 p9 R# x) i3 g5 C! D, mDim i As Integer   L$ Q4 |- Q) d+ g' [9 o0 u! G
Dim content As String = "<table>" * z7 u1 C" p( b6 ]7 A# b
For i=0 to count - 1
$ t7 d: a7 k% m' R, ~" V, D  Dim item As Item = results.GetItemByIndex(i)
: o5 T6 ~: ]& r% q7 \  content += "" + _
" @( m2 Y* E/ x( K+ [3 b9 J1 p    "<tr>" + _
; D$ Z- `/ h! h  f. P( s6 \      "<td>" + item.GetProperty("item_number") + "</td>" + _ ' K1 q) G! p# {. m! [/ a
      "<td>" + item.GetProperty("description") + "</td>" + _ 4 J0 N5 K# B) {/ u5 S2 O3 h
      "<td>" + item.GetProperty("cost") + "</td>" + _
( {5 J0 l* T+ u3 _+ M0 h$ ]    "</tr>" ' J1 B9 D: e  c( [+ ~! c* J5 `
Next
5 B* M/ r+ J& Z- J$ e# e3 }content += "</table>" 6 t5 f( C# d# [: m
& g/ |5 `8 c# R
Dim innovator As Innovator = Me.NewInnovator()
! v! E  l+ o  P, h( a4 ireturn innovator.NewResult(content)
' X- T" g" y3 R1 w
9 J& O8 q; C$ E' T) K% O9 I
" R9 H+ a9 |& o; e, [1 _
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了