Retrieve the saved state name as a string variable

When I save a state in workshop I would like to get access to the name of I insert as a workshop variable in order to reuse it downstream in an action for instance.

Is there a way in the state configuration panel to save the sate name in a variable (and always have access to it when I open the sate in the future) ?

Thank you

Hey @apiv, unfortunately this is not possible at the moment, but I’ve added a +1 to the ticket we are tracking internally for this.

If you know the folder where the saved state resides, children of a folder can now be queried using Foundry’s REST API: List Children Of Folder. This was my code for finding children of a folder:

from transforms.api import transform_df, Output
from transforms.external.systems import external_systems, Source


@external_systems(
    foundry_source=Source("[Insert REST API Data Connection Source RID]")
)
@transform_df(
    Output("[Insert output dataset RID]")
)
def compute(foundry_source, ctx):
    folder_rid = "[Insert parent folder RID containing Foundry children]"
    base_url = foundry_source.get_https_connection().url
    url = f"{base_url}/api/v2/filesystem/folders/{folder_rid}/children"
    client = foundry_source.get_https_connection().get_client()
    params = {"preview": "true"}
    response = client.get(url, params=params)

    # If the call fails, raise an exception and abort the transaction.
    response.raise_for_status()

    # Parse the incoming JSON as a dataframe and save it in a dataset.
    response = response.json()
    data = response.get('data', [])
    rdd = ctx.spark_session.sparkContext.parallelize(data)
    return ctx.spark_session.read.json(rdd)