起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 3866|回复: 1

[处理中3] table加了列以后如何排序

[复制链接]

506

主题

1631

帖子

3395

积分

论坛元老

Rank: 8Rank: 8

积分
3395
QQ
发表于 2018-8-8 09:46:48 | 显示全部楼层 |阅读模式
  1. String ksql = "select DE_ServiceDealer.* from DE_ServiceDealer DE_ServiceDealer where 1=1 " + typeFilter + gradeFilter + cityFilter + keywordsFilter + selectFilter;
  2.                 Table table = KSQL.select(ksql, null, "/dealer/dealer/data", null);
  3.                 //table增加一列“距离”
  4.                 table.addColumn("fRange", "Decimal");
  5.                 if (table.size() > 0) {
  6.                         Iterator<Row> iter = table.iterator();
  7.                         while (iter.hasNext()) {
  8.                                 Row row = iter.next();
  9.                                 //获取当前行的经度
  10.                                 BigDecimal fLocation = row.getDecimal("fLongitude");
  11.                                 //获取当前行的纬度
  12.                                 BigDecimal fLatitude = row.getDecimal("fLatitude");
  13.                                
  14.                                 if(fLocation != null && fLatitude != null && currentLon != null && currentLat != null){
  15.                                         // 通过两点的经纬度计算距离
  16.                                         BigDecimal ra=BigDecimal.valueOf(getDistance(fLocation.doubleValue(),fLatitude.doubleValue(),currentLon.doubleValue(),currentLat.doubleValue()));
  17.                                         row.setDecimal("fRange", ra.setScale(1, BigDecimal.ROUND_HALF_UP));
  18.                                 }
  19.                         }
  20.                 }
复制代码

我先用ksql查出数据到table,然后在table加了一列fRange,然后加入数据,现在想把table根据fRange排序,这个怎么做?

91

主题

13万

帖子

3万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
36198
发表于 2018-8-8 10:12:45 | 显示全部楼层
table中没有排序
远程的联系方法QQ1392416607,添加好友时,需在备注里注明其论坛名字及ID,公司等信息
发远程时同时也发一下帖子地址,方便了解要解决的问题  WeX5教程  WeX5下载



如按照该方法解决,请及时跟帖,便于版主结贴
回复 支持 反对

使用道具 举报

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

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2025-8-24 14:37 , Processed in 0.052557 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表