PLM之家PLMHome-工业软件与AI结合践行者

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

[复制链接]

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

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

admin 楼主

2018-8-1 13:37:47

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

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

x

9 B+ g: b8 t7 i( {5 f* {  X) m9 n8 o* c% v* g

: L( P& f2 \  ?7 g( C% a- [
5 z3 q3 V$ m+ C" m
Technique  
9 J$ W. e( C" HThere is no difference in setting up a query for a single Item or for many.  Only the ' k+ o0 A+ B' T& E, c+ |9 x1 p
criteria define the set size returned.  In this recipe you create an Item and populate
, U' R6 b3 l9 _the query criteria, apply it, and iterating over the Items returned producing a HTML
+ }* o' {0 R0 |4 I& @<TABLE>  fragment. 5 x6 n4 |. g' s5 ^5 x3 |
* I0 |3 K  ]" ]; o- g+ {- n
, q0 h0 l$ g8 m, Y% M* |! q
JavaScript  + e) i  ?8 }9 e$ g' f
var qryItem = this.newItem("Part","get"); " m" H+ L) U& S: N
qryItem.setAttribute("select","item_number,description,cost"); 0 Y4 o' |& Y3 D4 r( t: N
qryItem.setProperty("cost", "100", "gt");
. N" S1 W- ]2 o) F2 s2 W) Yvar results = qryItem.apply(); 8 \' a/ b9 d1 D% K
var count = results.getItemCount(); 5 ]0 d" H9 u, n6 ]% K
var content = "<table>";
! I4 E6 s) n8 p' A4 \. d/ efor (var i=0; i<count; ++i)
9 [8 j1 ^; I$ Z: K- P2 `( l{
" `* c, `" u0 E, G  var item = results.getItemByIndex(i); $ ?: f, C4 x8 N/ B* W7 F
  content += "" + " k+ [" {* l) O! J# N4 Z2 |) g+ \
    "<tr>" + 7 D' Q6 t) m3 Y& t0 C1 o! A
      "<td>" + item.getProperty("item_number") + "</td>" + ; c8 `5 u) y5 h! U9 J3 I3 V& ^  b
      "<td>" + item.getProperty("description") + "</td>" + ' C* U5 N9 ~' s+ e  U+ i
      "<td>" + item.getProperty("cost") + "</td>" +
8 U. y0 m1 l. y9 o, A+ o) v1 C    "</tr>";
5 b! A% w" J/ Y" C: j6 O# D}
: ?. o7 ~7 |- Q- f; X2 r2 Tcontent += "</table>"; & B# x& Z$ @( @. c  ?: W( {
return content;
5 p$ z: E& y9 r! S : Y% U+ V' b) V- l
C#  
& \. `6 c. x+ s% ?. B5 ~Item qryItem = this.newItem("Part","get"); 4 L. k) Z0 E' Y/ N0 I! S' g% U2 a- r
qryItem.setAttribute("select","item_number,description,cost"); - k1 @* J" l+ l
qryItem.setProperty("cost", "100", "gt");
3 l( Q9 {. i& ?7 G) iItem results = qryItem.apply();
& C& T% s0 Y' U* |int count = results.getItemCount(); , S) P; W1 C0 G: q
int i; : T1 e8 H/ B) K! C  D% r3 L
string content = "<table>"; + I' E5 X& s" u  M3 Y
for (i=0; i<count; ++i)
* L; A$ \. U& Y& o( s{
9 L+ X  O- O" q: F( C* B4 @: k0 C  Item item = results.getItemByIndex(i); # T* s1 A2 e2 b9 @1 [' B
  content += "" + ( j3 n* Z. Y; e. X9 y2 \, ]5 T
    "<tr>" +
4 M! d2 {0 d9 f* h      "<td>" + item.getProperty("item_number") + "</td>" +
  Y$ g. |! Q7 O, Q2 W      "<td>" + item.getProperty("description") + "</td>" + % ^# x" s# }# z9 Y* W' l
      "<td>" + item.getProperty("cost") + "</td>" +
- g- R9 R- |5 ]; Z0 \) w    "</tr>"; 7 W( L7 D7 ~$ t. m  c. ~
}
8 @* ^: O3 q  g9 h$ ^3 P0 q6 Wcontent += "</table>"; # N0 k1 g  C0 I5 O4 W; I3 l
Innovator innovator = this.newInnovator();
# t7 N/ V: i. Q* V: Ereturn innovator.newResult(content); . @. v/ R0 q* `6 P% S5 t, B: q
4 o) ~) i6 T8 r+ o7 ]
VB.Net  
0 }& u9 v( B# aDim qryItem As Item = Me.NewItem("Part","get") + Y3 Y3 h3 \! [: }# G0 W* s3 ?
qryItem.SetAttribute("select","item_number,description,cost") $ i) r7 D( O/ W
qryItem.SetProperty("cost", "100", "gt")
  f+ m! x# z1 _/ L: ~Dim results As Item = qryItem.Apply() " M0 ?/ e! p; q# E
Dim count As Integer = results.GetItemCount()
1 z2 d7 v& r% C( _* eDim i As Integer
; C9 X+ C- K- [& ?5 mDim content As String = "<table>" - Z$ o  i7 h% t- X6 W
For i=0 to count - 1
8 S* G3 W! m$ |( a$ R: t  Dim item As Item = results.GetItemByIndex(i)
% j) m  Y" Q9 Q3 e  content += "" + _ + g  s) F7 H( ]0 S
    "<tr>" + _
  B6 T5 b- |9 {% k      "<td>" + item.GetProperty("item_number") + "</td>" + _ / ~' x! ?1 V6 N, n" I
      "<td>" + item.GetProperty("description") + "</td>" + _ 3 l8 g  K- a6 h! ]
      "<td>" + item.GetProperty("cost") + "</td>" + _ 3 Q6 q7 T1 g- N5 B9 s; ?
    "</tr>"
5 O. R; _- C6 R* wNext
. c  g/ K6 R5 F! K3 rcontent += "</table>"
. M0 k" h1 N, C" H
3 R8 R0 P1 T8 p* d: E' l, w8 gDim innovator As Innovator = Me.NewInnovator()
, D1 Z* J9 y- _6 C$ C% `9 u8 F/ [* \return innovator.NewResult(content)
, |6 ~4 H( v' Y+ f3 y1 o+ D/ u) P9 W3 {9 I0 f6 B  h* z% w

! V) G  j9 \1 h2 u( _" k
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了