Skip to content

Column Value Library

referencesdk-column-value-lib

Introduction

Reads values a block picked from a column of another block.

The model stores each pick as a ColumnValueId — a string that names the column the value came from and the value itself (see Picking values of a column). The id is what lets the project know which block produced the value; the workflow needs only the value.

Args carry the ids as the model stored them, and an id may arrive wrapped in extra layers of JSON string escaping. Every function here accepts all such forms. Unwrap picked values explicitly at the start of wf.body, before using them or passing them to a tool: a tool given a raw id gets a JSON string, not the value.

A picked value is always a string: a value picked from a numeric column comes back as its decimal text ("2", "2.5"). Convert it with int() or float() where the workflow needs a number.

Sources

https://github.com/milaboratory/platforma/blob/main/sdk/workflow-tengo/src/workflow/column-value.lib.tengo

API

Import

columnValue := import("@platforma-sdk/workflow-tengo:workflow.column-value")

isColumnValueId

Tells whether a value is a ColumnValueId.

Arguments:

  • x: any - the value to test

Return:

  • result: bool - true for a string that decodes, possibly through extra layers of JSON string escaping, to a column value id

valueOf

Returns the value a ColumnValueId carries.

Arguments:

  • x: any - a picked value

Return:

  • value: string when x is a ColumnValueId - the picked value; x itself otherwise

valuesOf

Applies valueOf to every element of an array.

Arguments:

  • xs: []any - picked values

Return:

  • values: []any - the picked values, in the same order

Example:

wf := import("@platforma-sdk/workflow-tengo:workflow")
columnValue := import("@platforma-sdk/workflow-tengo:workflow.column-value")
wf.body(func(args) {
// Picked values arrive as column value ids; the analysis works with the plain values.
conditions := columnValue.valuesOf(args.conditions)
reference := columnValue.valueOf(args.referenceCondition)
// ... pass conditions and reference to the tool
return { outputs: {}, exports: {} }
})