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

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

[复制链接]

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

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

admin 楼主

2018-8-1 13:37:47

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

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

x

6 q9 ^9 j: A' l: ]* S4 v1 j, B, a* m8 ~/ h3 f5 s5 ^6 |

# B) p6 h0 K6 a8 |

% e! R3 R3 x: `8 d+ u3 {- A4 JTechnique  $ I/ h7 B9 a- W' m+ ?
There is no difference in setting up a query for a single Item or for many.  Only the $ J) j1 i8 o. h5 H" ?) h
criteria define the set size returned.  In this recipe you create an Item and populate 4 q8 u/ o) L9 h
the query criteria, apply it, and iterating over the Items returned producing a HTML
6 }3 A2 B+ g9 q! ]$ x' l0 k/ Z+ s) }! u- ~<TABLE>  fragment.
& E& x: |4 H" _( }* o$ y- Y& t2 ^
/ D# W9 d; c$ ]

/ K3 X" ~  m5 M& g! }* L* VJavaScript  - S* P% s+ R1 |: s! c" E- [: j- a
var qryItem = this.newItem("Part","get");
. p$ c( D1 ]1 {) B( sqryItem.setAttribute("select","item_number,description,cost");
6 \1 x& c4 Z% y0 F1 C1 g8 F6 sqryItem.setProperty("cost", "100", "gt"); 7 c$ _0 {: f& N/ e' {) G  f
var results = qryItem.apply(); / U  ?: c5 w. y' Z7 Y" J3 A2 W  z
var count = results.getItemCount();
) J2 J3 @5 N0 g7 {  hvar content = "<table>";
8 g6 k: }- [4 ?0 d2 I7 Lfor (var i=0; i<count; ++i)
6 L7 N) C9 u7 C+ }{ , S# S/ f2 a- b5 c) T/ p
  var item = results.getItemByIndex(i); 2 W/ {: o5 A7 m# t" W% {% ]5 t
  content += "" + 5 e, X* K; N* G* y! S' e
    "<tr>" + 5 [! ^+ v3 H( C3 Q, Q
      "<td>" + item.getProperty("item_number") + "</td>" +
/ r* t$ y3 d6 q( B; {1 w      "<td>" + item.getProperty("description") + "</td>" +
1 b; A, c3 L. }/ d/ d# S  a      "<td>" + item.getProperty("cost") + "</td>" + ' v. X4 s1 \& E
    "</tr>";
5 s' i0 X, |* E# ]: D' p1 q} , A8 v9 [; b( B$ ]* e- j
content += "</table>";
; r. |0 L! Y  kreturn content; ! Y9 f5 n; \: m& K+ c! S

0 {) O! C) Y1 u8 y- RC#  
  _" X; ^- r4 \( z2 NItem qryItem = this.newItem("Part","get");
. F, K" }+ z' S- e. n4 o2 dqryItem.setAttribute("select","item_number,description,cost");
1 S: O; A! K  y, g4 B- |( \# wqryItem.setProperty("cost", "100", "gt"); / m& ^: P& O8 Q5 i/ r
Item results = qryItem.apply(); ! P6 c- g, {+ l* O# Q' O& A
int count = results.getItemCount(); ) j5 r, i; M+ O
int i; 6 K# I5 H! r) k3 i$ C
string content = "<table>";
% b$ G2 q/ y$ `for (i=0; i<count; ++i) * w) o; ?9 ]" h- {6 E5 j
{
+ B1 @& F, Q% d0 @" `  Item item = results.getItemByIndex(i); ) R- o1 S* c: _
  content += "" +
1 E8 z& B( h& P# \* a  v    "<tr>" +
+ |9 U0 ]0 G+ Y# j      "<td>" + item.getProperty("item_number") + "</td>" + 7 Z! P' A& e. a: S# o
      "<td>" + item.getProperty("description") + "</td>" +
7 @( Q$ f+ w# z# G      "<td>" + item.getProperty("cost") + "</td>" + ' d: X! @' e6 P; T" j/ `
    "</tr>";
- x+ r6 X/ y; U1 r  |& Q} / b: ?' _7 @2 s/ G+ Y
content += "</table>";
; m3 f+ r& G7 ~( T6 w, G6 IInnovator innovator = this.newInnovator();
! N7 `5 u' W8 P' @  ureturn innovator.newResult(content);
; n: d8 V  [, y9 j% t( F
- F: S1 m% q! sVB.Net  " }& g9 t# ?+ i' ?( _
Dim qryItem As Item = Me.NewItem("Part","get")
0 J6 a- D1 u4 J" SqryItem.SetAttribute("select","item_number,description,cost") 0 a# t7 E* J3 L; v/ |6 A
qryItem.SetProperty("cost", "100", "gt")
  k7 Z& W6 W' s% BDim results As Item = qryItem.Apply() ) o4 R" E2 [5 R# V
Dim count As Integer = results.GetItemCount() # G3 a( X8 q9 [" H5 o; _% K
Dim i As Integer
" ~: q6 w: n9 s! t. }( aDim content As String = "<table>" / t: \2 z. ?6 u9 ]: U
For i=0 to count - 1 1 x6 M, Z# j' E- I. [# u
  Dim item As Item = results.GetItemByIndex(i)
3 y- @- Y) o! X1 m5 H4 D2 }" O  content += "" + _
! f  r: ?9 j, n: i% {" a3 p  y# h    "<tr>" + _
+ m, t$ X4 \6 b3 h$ M9 Z; N- e      "<td>" + item.GetProperty("item_number") + "</td>" + _ - N( y7 i3 Y0 P5 x" ^3 U( M7 R1 r
      "<td>" + item.GetProperty("description") + "</td>" + _ 0 R& I9 V3 F1 C  B8 t6 ]$ B9 o
      "<td>" + item.GetProperty("cost") + "</td>" + _
  k( q, d" _# l# Z# }7 a    "</tr>"
4 j4 I' Q; `. w# a" f9 G! S' D& t/ D' vNext $ q. W" f7 r1 g2 e, ^; b
content += "</table>" ' z# [" X) `7 `; U2 H
  G7 _0 u+ l4 g; s7 S$ t) @5 m
Dim innovator As Innovator = Me.NewInnovator() 2 k3 N; O- w  t: O
return innovator.NewResult(content)
& P) s; o4 R$ h! k: Q# i& X, O% i  u5 _0 ^. l4 k& U
$ r$ l5 q6 t8 |* h9 C5 e
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了