aiM18 Developer Center aiM18 Developer Center
DOC Home
  • Platform

    • Overview
    • Frontend Framework
    • Backend Framework
    • EBI Development
    • JSF Components
    • BPM Extension Interface
    • Telescope Extension Interface
    • Mobile App Setup
  • ERP

    • ERP EJB Interfaces
    • ERP XML Config Files
    • ERP Decorators (Frontend Interfaces)
  • Tutorial

    • Setup Development Environment
    • Sample App
  • Platform

    • Authentication
    • Common JSON Objects
    • Core Services
    • EBI Services
  • Enterprise Resource Planning
  • Human Capital Management
  • Business Process Management
  • Schedule Management
  • Document Management
  • Tutorial

    • Interacting with aiM18 via webservices
Tutorial
GitHub (opens new window)
DOC Home
  • Platform

    • Overview
    • Frontend Framework
    • Backend Framework
    • EBI Development
    • JSF Components
    • BPM Extension Interface
    • Telescope Extension Interface
    • Mobile App Setup
  • ERP

    • ERP EJB Interfaces
    • ERP XML Config Files
    • ERP Decorators (Frontend Interfaces)
  • Tutorial

    • Setup Development Environment
    • Sample App
  • Platform

    • Authentication
    • Common JSON Objects
    • Core Services
    • EBI Services
  • Enterprise Resource Planning
  • Human Capital Management
  • Business Process Management
  • Schedule Management
  • Document Management
  • Tutorial

    • Interacting with aiM18 via webservices
Tutorial
GitHub (opens new window)
  • Web Services Tutorial
  • Search
    • Introduction
    • Aim
    • Scenario
    • Refer to the document
    • Understanding stSearch
    • Buildup Search Condition
    • Get ID by Code
    • Summarize all the steps together
    • FAQ
  • Create Module Data
  • Modify Module Data
  • Check Stock Level
  • Outstanding AR/AP
  • Web Services Tutorial
Multiable
2024-01-09
目录

Search

Version: 1.2 | Release Date: 07/02/2024

# Introduction

The primary purpose for aiM18 system is to enhance your data management.

With aiM18, data only needs to be input once and can be viewed everywhere.

# Aim

After reading this chapter, you should be able to:

  1. Retrieve Data from aiM18
  2. Obtain Module Record Unique ID

# Scenario

Chris is IT Manager of ABC Fruit Company. He is responsible for maintaining ABC Fruit Catalog which shows imported fruits and local fruits separately.

wst01

Jane, manager from Marketing Department, contacts Chris from time to time for adding different new products.

Due to heavy workload on Chris, he often fails to release latest catalog on time.

This hindered promotion campaigns proposed by Jane.

Chris decides to solve it by using aiM18 Data Search Web Service.

# Refer to the document

The following content demonstrating how to retrieve data from aiM18.

For more detail, please refer to the complete documentation for search services.

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://127.0.0.1:8080/jsf/rfws/search/search?stSearch=employee&startRow=1&endRow=10")
  .get()
  .addHeader("authorization", "Bearer MjZhZGNjMDctODVhZS00MmE0LWI3ZmEtNzRhMTQwZGZiNTY0")
  .addHeader("client_id", "C-SGF2aWQncyBhcHBsaWNhdGlvbjIwMTctMDItMTAxNjc=")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();

HTTP Request

GET http://[server]/jsf/rfws/search/search?stSearch=[stSearchName]&startRow=[startRow]&endRow=[endRow]

Search Parameters

Name Type Description
authorization String(Header) Required. Access Token obtained via OAuth
client_id String(Header) Required. Client ID in aiM18 OAuth Applications
stSearch String(Query) Required. Lookup type, such as 'employee', can be found in Data Dictionary or UDF Lookup.
startRow int(Query) The start row of the search
endRow int(Query) The end row of the search
beId long(Query) If the search is BE specific, beId need to input
formatId long(Query) Search format ID
conds String(Query) Please check Condition Detail
sorts String(Query) Sort Fields ,split by ";". If not ascending, please use "!"; Example:"code;!desc"
resultFields String(Query) If you want to return some fields value, please this parameter.
lookupField boolean(Query) If the value is true, then the result data will be no expired,no locked, and approved.
quickSearchStr String(Query) If you want to use quick search ,please set this value.
fieldDesc boolean(Query) If the value is true, the will return the field's name and mess value.
viewDeleted boolean(Query) If you want to search the data already be deleted, Please use this value true.

# Understanding stSearch

aiM18 Data Search Web Service relies solely on stSearch parameter.

Within the aiM18 platform, stSearch is also referred to as the Lookup.

Lookup is a searching scheme predefined in aiM18, it covers information of tables, sorting and table joins involved in a search.

You can obtain stSearch code by visiting Lookup in aiM18:

wst02

In aiM18, the same module can have many different stSearch. Some settings are predefined by the system, while others can be customized by the user.

A standard stSearch is provided by each module, which should be suitable for most scenarios.

For instance, by visiting the Product / Material editor, you can access the standard stSearch used by this module.

wst04

1. Click Edit Query

wst05

2. Click Lookup

The code in brackets is the stSearch code we want.

wst06

# Buildup Search Condition

Next we need to prepare different product lists which show imported fruits and local fruits respectively.

aiM18 Data Search Web Service allows you to provide a SQL like WHERE clause to filter data.

wst07

Assume [Series] is the field to distinguish product, we need to know its corresponding column name in Database.

aiM18 provides a convenient way for you to know the corresponding database column for a field directly on the interface.

First, you need to enable [Show Field Name] Option in the interface settings.

wst08

Next, place the cursor on the column you want to view, in this case it is [Series], and the system will display the corresponding field information.

wst09

# Get ID by Code

After collecting above information, it is easy to come up with the following condition:

For imported fruits:

seriesId=equals=IMPORT

For local fruits:

seriesId=equals=LOCAL

For all lookup fields in aiM18, When building Search Condition, we should use record id instead of record code.

Record id can be obtained by using Get Id by Code Web Service.

Sample request to find Id of Series

GET `http://[server]/jsf/rfws/entity/getIdByCode/series?menuCode=series&code=IMPORT`

GET `http://[server]/jsf/rfws/entity/getIdByCode/series?menuCode=series&code=LOCAL`

Sample Response

{"withMulti":false,"id":"1","withRight":true}

{"withMulti":false,"id":"2","withRight":true}

# Summarize all the steps together

Sample request to search Products where Series = LOCAL

GET http://[server]/jsf/rfws/search/search?stSearch=pro&conds=seriesId=equals=2

Sample Response

{
 "size":{
	 "size":4,
	 "values":[
		{"code":"Orange","desc":"Local Orange","iRev":2,"id":8 ...},
		{"code":"Banana","desc":"Local Banana","iRev":2,"id":6 ...},
		{"code":"Apple","desc":"Local Apple","iRev":2,"id":5 ...},
		{"code":"Peach","desc":"Local Peach","iRev":2,"id":7 ...}
	 ]
 }
}

# FAQ

1. How can I know I have to use id instead of the code?

You can check by Data Dictionary. All fields with Lookup value are storing the reference id.

wst11

Last Updated: 2025/05/13, 07:58:58
Web Services Tutorial
Create Module Data

← Web Services Tutorial Create Module Data→

Theme by Vdoing | Copyright © 1990-2025 Multiable | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式