ValueArray

ACF12 has added the function “ValueArray” and of course it does not match our function “valueArray”.
Our function matches the interface of the function ValueList and the ACF function takes 2 arguments.

ACF12 Implementation:

    valueList(qry.columnName);
    valueArray(qry,"columnName");

Lucee

    valueList(qry.columnName);
    valueArray(qry.columnName);
    queryColumnData(qry,"columnName"); // works the same way as ValueArray in ACF

So in my opinion the Lucee implementation is much more consistent, anyway question is how we handle this.

We have 3 options:

  1. we keep it as it is (0h)
  2. we implement it the same way as the ACF impl (0.1h)
  3. we make it possible that the function works in both ways, so it can handle one argument (queryColumn) or two (4h)

Of course option 3 is the best, question is, it is worth to spend 4h on it or should we simply go for option 2 and break backward compatibility on this? i don’t think a lot of applications are using this.

1 Like

Or maybe implement ACF’s version too but you need to set something in the application.cfc and you get an error telling you as much if you try to pass two variables.

I have used this function at least twice so it’s unfair to screw with existing Lucee applications because ACF2016 implemented something badly

4 - log bug with Adobe

should happen when ACF12 was in beta, to late now i think

I think there could have been an updated. Difficult to log a bug on a private beta.

I think the logic for
valueArray(query, "column");

is so that it can be used as a member function of a query as in:

Query.valueArray("column");

(it was referenced in the whole bug ticket) https://bugbase.adobe.com/index.cfm?event=bug&id=3499033

0.4 hr solution …
0.1 Rename valueArray to valueListArray
0.1 create a new function valueArray() that checks arguments.len() and:
0.1 if one, calls valueListArray(argumentCollection=arguments),
0.1 if two, calls queryColumnData(argumentCollection=arguments)

Problem is that valueArray like valueList are very special (java based) functions. there is one big difference between ACF and Lucee when it comes to query columns. in Lucee this #query.columnName# normally represents the value of the current row of the query, not the hole column as it does in ACF.
This difference exists for performance reasons.

So normally valueList(query.columnName) would only see the value of a certain row of a column, not the hole column. But the function valueArray defines “queryColumn” as argument type what forces the compiler to make some tricks to get this working. what makes that function not very flexible.

ticket:
https://luceeserver.atlassian.net/browse/LDEV-857

i decided to implement solution nr. 3 ( make it possible that the function works in both ways, so it can handle one argument (queryColumn) or two), in addition we will do the same for the function valueList, to be consistent.

2 Likes

It just shows how clueless the ACF team is when it comes to API design.

I don’t expect them to follow “our” conventions etc., but given the fact that ValueList() is already defined in ACF a certain way – making the interface of ValueArray() completely different is very telling…