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.

Weird error table is still working perfectly

Chris_D_Mentes_001Chris_D_Mentes_001 Member, csevp Posts: 102 PRO

I'm getting this error when I use a Custom Table I made in anywhere that isn't the origonal document. Table is still showing up and everything seems to be working.

I have no idea what it is but it's kind of annoying having the yellow excelamation mark whenever I open up the table.

Typecheck canBeTableRow failed (isTableValue(entry.value) || entry.value is TableCellError)
183:9
onshape/std/table.fs (canBeTableRow)
192:12
onshape/std/table.fs (tableRow)
102:33
c8eef2271809c4293325c9b1/4227b687e7c4b5093ac931f5/5807a7fe9c52c03aea23880a (const nameAndMaterial)
53:16
onshape/std/table.fs (defineTable)

Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,210

    Please see

    We can't figure out what's wrong if we can't see your table code.

    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • Chris_D_Mentes_001Chris_D_Mentes_001 Member, csevp Posts: 102 PRO

    Sorry I'm aware of that but the whole document is company propery unfortunitally, so here is the code in question:

    annotation { "Table Type Name" : "Alphacam CSV Table" }
    export const nameAndMaterial = defineTable(function(context is Context, definition is map) returns Table
    precondition
    {
    annotation { "Name" : "Exported File Name" }
    definition.fileName is string;

        annotation { "Name" : "Part Studio Name" }
        definition.studioName is string;
        
    
    }
    {
        var columns = [
            tableColumnDefinition("partFile", "Job File"),
            tableColumnDefinition("layerMap", "Layer Mapping Setting"),
            tableColumnDefinition("finishAndSide", "Material Type Name"),
            tableColumnDefinition("rotationMethod", "Nest Part Rotation Method"),
            tableColumnDefinition("rotationAngle", "Nest Rotation Angle"),
            tableColumnDefinition("tryMirror", "Try Mirrored Shape"),
            tableColumnDefinition("edgeDisc", "Edging Discription"),
            ];
    
        var rows = [];
        var seenSoFar = {};
        for (var part in evaluateQuery(context, qAllModifiableSolidBodies()->qHasAttribute("finish")))
        {
            //Common variables
            var finishData = getAttribute(context, {
                    "entity" : part,
                    "name" : "finish"
            });
            var substrate = getAttribute(context, {
                    "entity" : part,
                    "name" : "substrate"
            });
            var seen = getAttribute(context, {
                    "entity" : part,
                    "name" : "seen"
            });
            
            //Use windows standard file nameing for duplicates
            var partName = getProperty(context, { "entity" : part, "propertyType" : PropertyType.NAME });
            if(seenSoFar[partName]==undefined){seenSoFar[partName]=1;}
            else {seenSoFar[partName]+=1;}
            if(seenSoFar[partName]>1)partName = partName~" ("~(seenSoFar[partName]-1)~")";
            
            //Layer Mapping Setting name builder
            var LMS1 = substrateLookup[substrate].alphaLayerMappingStart;
            var LMS2 = seen?"Seen":"Hidden";
            
            //Get Grain
            var isGrained = getAttribute(context, {
                        "entity" : part,
                        "name" : "grainDirection"
                })!=undefined;
            
            //Get face5 and face6 areas
            var face5 = qOwnedByBody(part, EntityType.FACE)->qHasAttributeWithValue("faceSide", faceSide.FACE5);
            var face6 = qOwnedByBody(part, EntityType.FACE)->qHasAttributeWithValue("faceSide", faceSide.FACE6);
            var face5Area = evArea(context, {
                    "entities" : face5
            });
            var face6Area = evArea(context, {
                    "entities" : face6
            });
            
            //Assign Raw finish names PB Raw (Particle Board) MDF Raw (Medium Desnity Fibreboard)
            var finish;
            var goodSide = getAttribute(context, {
                    "entity" : part,
                    "name" : "goodSide"
            });
            if(finishData.finish=="Raw"){
                if(substrate==substrates.PB) finish="PB Raw (Particle Board)";
                if(substrate==substrates.MDF) finish="MDF Raw (Medium Desnity Fibreboard)";
                if(substrate==substrates.PLY) finish="PLY and Softwood";
                }
                else if(finishData.vendor=="Standard")
                {
                    finish = finishData.finish~goodSide;
                }
                else
                {
                    finish = finishData.vendor~" "~finishData.finish~goodSide;
                }
            
            //Assign Variables
            var fileName = definition.fileName~"\u005C"~definition.studioName~" - "~partName~".x_t";
            var layerMappingSetting = LMS1~" "~LMS2;
            var rotationMethod = isGrained?"Grain In X (Allow 180 Rotation)":"Free Rotation";
            var nestRotation = isGrained?180:360;
            var tryMirror = tolerantEquals(face5Area, face6Area)?true:false;
            var edgeDisc = getAttribute(context, {"entity" : part,"name" : "edgeDisc"});
            
            //Populate Row
            rows = append(rows, tableRow({ "partFile" : fileName,"layerMap":layerMappingSetting,"finishAndSide":finish,"rotationMethod":rotationMethod,"rotationAngle":nestRotation,"tryMirror":tryMirror,"edgeDisc":edgeDisc}));
        }
    
        return table("Part volumes", columns, rows);
    });
    

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,210

    So, looking at the code for 5 seconds, my suspicion falls on edgeDisc being possibly undefined — that would cause that error. You can use the new undefined-coalescing operator to give it a default string value — see if that makes the issue go away:

    var edgeDisc = getAttribute(context, {"entity" : part,"name" : "edgeDisc"}) ?? "undefined";
    

    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • Chris_D_Mentes_001Chris_D_Mentes_001 Member, csevp Posts: 102 PRO

    OOOOOOOO I can use that! that's exciting there's a lot of places where I have:

    var myVariable;

    if(someValueToTryToFetch != undefined)
    {

    myVariable = someValueToTryToFetch;

    }

    now I can just type:
    var myVarialbe = someValueToTryToFetch ?? "value undefined looser";

    is that right?

    Alas that didn't do the trick, my table still looks perfect like but the warning is still there. Edge Disc is usually an empty string. that doesn't cause the issue though as I can't recreate the error in other part studios by leaing edgeDisc blank.

  • Chris_D_Mentes_001Chris_D_Mentes_001 Member, csevp Posts: 102 PRO

    That is crazy I just duplicated and moved the part studio into the document where the table was written and the warning is gone, despite the table being the same version in both documents. I've got a feeling this warning is only showing up because all the features that I've been writting were in develpment while this part studio was being made and may have messed up the metadat to mutch for the parts maybe?

    I'll drop it for now and see if the issue comes back later

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,210

    Yes, we added ?? recently: https://forum.onshape.com/discussion/comment/106372/#Comment_106372

    Regarding the latent error, again, we can't help without a shared doc, but it sounds like you're over the problem.

    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • Chris_D_Mentes_001Chris_D_Mentes_001 Member, csevp Posts: 102 PRO

    Have I gone crazy or is there no way to mark this as answered now?

  • Oliver_CouchOliver_Couch Member Posts: 142 PRO

    If you made the topic as a discussion instead of a question topic you won't have that option.

  • Chris_D_Mentes_001Chris_D_Mentes_001 Member, csevp Posts: 102 PRO

    @Oliver_Couch

    Ugh crap, I'll make sure to do that next time

Sign In or Register to comment.