Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Simple For Each Question

Hello together,

I' ve adapted a Query of a colleague, the requirement is a loop.

We' re working with pixi (ERP) and using APIs to get any Information...

With this Script we' d like to get the available & physical stock of an Item.

For the API, we' ve to put in the EAN Code to get an result.

Loading all EANs

LOAD

EANUPC as EAN

// ItemNrInt

FROM [lib://pixiReadItems (nickismode_administrator)]

(XmlSimple, table is [Envelope/Body/pixiReadItemsResponse/pixiReadItemsResult/SqlRowSet/diffgram/SqlRowSet1/row]);

Put them into the API with a Loop

FOR Each BN in FieldValueList('EAN')

[Pixi Get Item Infos]:

Webfile, generated with QV Source

Let Libr =

'http://localhost:5555/QVSource/WebConnectorV2/?table=RawResponse&verb=POST&url=https%3a%2f%2fapi.pix...

Reading the needed Information

Load

AvailableStock,

PhysicalStock,

PhysicalStockAllLocations,

// SupplPrice,

// ItemKey,

EANUPC as EAN

// ItemNrSuppl,

// ItemNrInt

FROM [lib://pixiGetItemStock (nickismode_administrator)]

(XmlSimple, table is [Envelope/Body/pixiGetItemStockResponse/pixiGetItemStockResult/SqlRowSet/schema]);

next BN

but it doesn' t work the way we wanted to.

It loads and loads but there' s no result... I hope you can help me.

Regards

Christoph

2 Replies

Re: Simple For Each Question

Fieldvaluelist is not a valid qlik-function - your script should be more look like:

//Loading all EANs

LOAD

concat(EANUPC, chr(39) & ',' & chr(39)) as EAN

// ItemNrInt

FROM [lib://pixiReadItems (nickismode_administrator)]

(XmlSimple, table is [Envelope/Body/pixiReadItemsResponse/pixiReadItemsResult/SqlRowSet/diffgram/SqlRowSet1/row]);

let vEANList = fieldvalue('EAN', 1);

//Put them into the API with a Loop

FOR Each BN in '$(vEANList)'

[Pixi Get Item Infos]:

...

- Marcus

Re: Simple For Each Question

I must correct me that fieldvaluelist() is really an undocumented but valid function, see: https://www.qlik2go.net/en/2015/06/08/a-beautifull-list-with-fieldvaluelist-2/

- Marcus

Community Browser