Default value for vertex parameter?

I feel like I may be missing something obvious here. I want to have an optional parameter, but yet when I call this query and omit the second vertex, I get the error:

“Failed to convert user vertex id for parameter excCon”

even when I set exclude to false and therefore I am not even accessing it. Can I set a default that will allow me to omit the parameter, and not get the error, and only try to access it if the exclude parameter is true?

CREATE QUERY zMarksLogic(VERTEX<Concept> incCon,VERTEX<Concept> excCon, BOOL exclude =false)  { 
        ...... use the incCon vertex ......
	    IF exclude THEN
	          .......  use the excCon vertex ......

@markmegerian On the top, you’re setting the state by using one equals sign exclude=false (looks good)

Next, you should check the state by using two equal signs. Is that what you are doing and getting the error?

IF exclude == false THEN

But also the way you are describing should work as well. Humm.

Thanks Jon - I think the issue is that despite the logic in the body of the query, the query will not run because it cannot convert the parameter unless I specify a value vertex ID. Trying to have an optional argument for a VERTEX where I dont want to pass one in at all

You can define a Set incCon, then check the size of the set. incCon.size()


Good idea - since I only want one vertex, should I then use a FOREACH to isolate the VERTEX, or is there a better way?