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

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

admin 楼主

2018-8-1 13:37:47

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

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

x
) S% b: z: ?/ I1 x6 n* s' U
/ a% \& r% I4 q5 f* f

& ~# V. ~5 p* q$ p' r. q% u
5 \; Q1 l, I5 W# p8 Z# ~9 [
Technique  
+ Z5 \4 T/ e& V) m# T$ D6 _8 yThere is no difference in setting up a query for a single Item or for many.  Only the
! N! o$ o% z5 g! F: [criteria define the set size returned.  In this recipe you create an Item and populate
2 S" u4 L8 L+ R5 F. L* Pthe query criteria, apply it, and iterating over the Items returned producing a HTML   R; I$ q! N' `6 `1 Q. T; w8 N+ L
<TABLE>  fragment.
( t5 K+ k" x) R8 Z) @7 x: b* x% O: m* g3 _& ?

& [: r- q. L. N" ~; fJavaScript  $ L+ I+ Q0 ~. u5 E% v; g9 I) E
var qryItem = this.newItem("Part","get"); 1 A4 _* W5 ~& h
qryItem.setAttribute("select","item_number,description,cost");   K, r' K( j7 R  ^& Y$ P
qryItem.setProperty("cost", "100", "gt");
" h! n! U$ d/ H$ v7 _1 mvar results = qryItem.apply(); # K* [. K6 p& x
var count = results.getItemCount();
1 v' M& }2 Y+ J. k* a8 Lvar content = "<table>"; - w, I. ^- z4 `9 O9 V+ [) V0 {
for (var i=0; i<count; ++i) 1 x8 y0 m- i* V
{
, D# ^& I3 L9 F0 p: p+ p6 z2 Z  var item = results.getItemByIndex(i);   k! Z; ]; O. a9 v
  content += "" +
- W, }+ K0 ~5 e3 C    "<tr>" +
, ?3 q7 {0 s( L* m  D2 w6 E5 |1 X" w      "<td>" + item.getProperty("item_number") + "</td>" +
- b5 N1 E  V- T& o" R      "<td>" + item.getProperty("description") + "</td>" + # c5 H) ~6 O5 H
      "<td>" + item.getProperty("cost") + "</td>" + ) Q4 w% n) H5 ~) j# I& s
    "</tr>";
) p9 }$ ]3 Y9 y( n- i; Y9 E  o, Q} 9 G- y( I& \5 n. J# o+ D  e
content += "</table>"; 3 U+ O! d% a' o4 t9 ~
return content; ) K) U. h3 z( ~" ~! b
' W. q+ X$ F  t2 D) s; \
C#  
* r- N- J8 N+ z0 w+ R0 ^Item qryItem = this.newItem("Part","get");
3 u% B! J. @% f& C# l6 A$ B  UqryItem.setAttribute("select","item_number,description,cost");
* A7 l4 v" N8 T3 v/ S# JqryItem.setProperty("cost", "100", "gt"); , P/ k3 y; i# s9 f- k
Item results = qryItem.apply();
% p' w- [; i/ |int count = results.getItemCount(); / z0 _9 Z/ m9 A* v) r% s
int i;
" [# j6 M% E5 @$ h; u2 c0 Y; ^string content = "<table>"; / E( L  p, O. F7 Z( D% N) W
for (i=0; i<count; ++i)
5 `8 z. ^7 z; o  v* H2 E4 S{ ; [8 B8 t( B0 N3 U
  Item item = results.getItemByIndex(i); 1 H" }. @) `6 e
  content += "" + ( P7 y$ A8 T3 b( X. X0 Z6 C
    "<tr>" + ( [. r$ e, L7 U6 o+ n
      "<td>" + item.getProperty("item_number") + "</td>" +
. ^, m, T% K6 ]8 A- N( T      "<td>" + item.getProperty("description") + "</td>" + 5 z& e0 [% m* r  Y5 }. H  K2 r/ p, m
      "<td>" + item.getProperty("cost") + "</td>" + ) B$ d& O9 p$ d5 Q* _$ s. b
    "</tr>";
. M( u4 J- r" ~; S}   L  M" E" [3 N- C: J
content += "</table>";
' g1 I/ f6 z% s4 `" ZInnovator innovator = this.newInnovator(); - G, H' ?. t7 w+ w  i5 T/ j/ \
return innovator.newResult(content);
, \& M# N2 s: I2 ^" L+ `7 | ; ]4 Z7 G, m$ i$ ]7 H
VB.Net  0 i( ?  T; A4 m1 I* O/ s3 r, w
Dim qryItem As Item = Me.NewItem("Part","get")
  I# b) v7 c% E& c, B9 cqryItem.SetAttribute("select","item_number,description,cost")
* e8 t  }% I: a2 `+ hqryItem.SetProperty("cost", "100", "gt") 0 A+ K, _2 F( o# q* ^5 h% Y
Dim results As Item = qryItem.Apply()
5 |; i2 J  x% y$ @Dim count As Integer = results.GetItemCount() / ^- e/ s" e, D6 ?# ]3 L
Dim i As Integer
7 K: x) n. K! [! ]Dim content As String = "<table>" 4 t7 _( d! @$ _5 H6 _( g) o% \
For i=0 to count - 1
2 b0 ~/ M! {% j: B  Dim item As Item = results.GetItemByIndex(i) 6 d4 a) D. F) T5 Q* s
  content += "" + _
* ]6 L4 H( S! e6 A3 _. h    "<tr>" + _ + h+ y0 s( {# O# K4 m% o
      "<td>" + item.GetProperty("item_number") + "</td>" + _ ' [7 _4 h+ t+ V# j
      "<td>" + item.GetProperty("description") + "</td>" + _ 7 }1 `; {/ T) N, |4 a2 Y& e
      "<td>" + item.GetProperty("cost") + "</td>" + _
4 t0 k% w! k6 m1 O    "</tr>"
8 V  O5 K' J9 j. }& L4 Y- VNext 7 G# C" b, v; m4 \/ `4 g
content += "</table>"
& W/ U" k" [3 I) w
7 E9 ^# |7 `) U: T4 @/ _, u2 x! GDim innovator As Innovator = Me.NewInnovator() 9 L# g$ u' P3 p
return innovator.NewResult(content) ! [5 t; T) j8 G) s+ m
1 r' \) S# \; z% `. V7 T
" r  }1 ^) l$ {/ U' u2 w' N
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了