Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Options

Sorting Variable Name

When I created feature script that import data from CSV then add to Variable Table, the arrangement are random. How can make the arrangement the way I wanted?
Here's the script:

FeatureScript 1711;
import(path : "onshape/std/geometry.fs", version : "1711.0");


annotation { "Feature Type Name" : "CSV Configurator"}

export const importCSV = defineFeature(function(context is Context, id is Id, definition is map)
    precondition
    {
        annotation { "Name" : "Table" }
        definition.pointData is TableData;

    }
    {
        var importedData = definition.pointData.csvData;
        for (var i = 0; i < 11; i += 1)
        {
            setVariable(context, importedData[i][0], importedData[i][1]);
        }
    });
    

Answers

  • Options
    _anton_anton Member, Onshape Employees Posts: 279
    Indeed, this is a limitation that shows up when a feature writes multiple variables. Do feel free to submit an improvement request.
  • Options
    NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,412
    sort()
    Senior Director, Technical Services, EMEAI
Sign In or Register to comment.