Anonymous_User Absent Member.
Absent Member.
154 views

Combining Query results and adding them to a picklist

Hello,

Maybe someone here can help me with this.

I have 2 queries, and I would like to combine the results of those 2, and
add the result to a picklist on the a form.

I have tried the following (and variations of the following), but it
isn't quite the correct result I am getting. Any answers appreciated. I
will be forever in your debt, should you have the perfect idea for a
solution.

var combinedRoles = new Array();

var delegatorRoles = IDVault.globalQuery(null,
"QRoleKompetenceDelegateRightsRoles", {name:"*"});
var delegateableRoles = IDVault.globalQuery(null,
"QRoleKompetenceDelegateable", {name:"*"});

if (delegateableRoles.length > 0 ) {
var i = 0;
while ( i < delegateableRoles.length ) {
combinedRoles.push(delegateableRoles[0]);
i++;
}
}
if (delegatorRoles.length > 0 ) {
var i = 0;
while ( i < delegatorRoles.length ) {
combinedRoles.push(delegatorRoles[0]);
i++;
}
}

field.setValues(combinedRoles);

-Nicolai
Labels (1)
0 Likes
4 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Combining Query results and adding them to a picklist

What about something like this:


for ( var i=0; i< delegateableRoles.length; i++ ) {
combinedRoles.push( delegateableRoles[0] );
}
for ( var j=0; j< delegatorRoles.length; j++ ) {
combinedRoles.push( delegatorRoles[0] );
}


Wolfgang




On 04.11.2012 14:22, Nicolai Jensen wrote:
> if (delegateableRoles.length> 0 ) {
> var i = 0;
> while ( i< delegateableRoles.length ) {
> combinedRoles.push(delegateableRoles[0]);
> i++;
> }
> }
> if (delegatorRoles.length> 0 ) {
> var i = 0;
> while ( i< delegatorRoles.length ) {
> combinedRoles.push(delegatorRoles[0]);
> i++;
> }
> }

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Combining Query results and adding them to a picklist

On Sun, 04 Nov 2012 18:58:15 +0000, Wolfgang Schreiber wrote:

Hello Wolfgang,

That worked smoothly. Got an undefined as the last item in the picklist,
but I am able to get around that.
Now I will withdraw to my inner space, and ponder about the differences
in the code, to try to fully comprehend the differences, so I can
understand why your code works and mine does not 🙂

> What about something like this:
>
> for ( var i=0; i< delegateableRoles.length; i++ ) {
> combinedRoles.push( delegateableRoles[0] );
> }
> for ( var j=0; j< delegatorRoles.length; j++ ) {
> combinedRoles.push( delegatorRoles[0] );
> }

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Combining Query results and adding them to a picklist


Most important: [0] != [0]

Wolfgang

On 05.11.2012 09:13, Nicolai Jensen wrote:
> On Sun, 04 Nov 2012 18:58:15 +0000, Wolfgang Schreiber wrote:
>
> Hello Wolfgang,
>
> That worked smoothly. Got an undefined as the last item in the picklist,
> but I am able to get around that.
> Now I will withdraw to my inner space, and ponder about the differences
> in the code, to try to fully comprehend the differences, so I can
> understand why your code works and mine does not 🙂
>
>> What about something like this:
>>
>> for ( var i=0; i< delegateableRoles.length; i++ ) {
>> combinedRoles.push( delegateableRoles[0] );
>> }
>> for ( var j=0; j< delegatorRoles.length; j++ ) {
>> combinedRoles.push( delegatorRoles[0] );
>> }

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Combining Query results and adding them to a picklist

On Mon, 05 Nov 2012 12:51:56 +0000, Wolfgang Schreiber wrote:

> Most important: [0] != [0]


Thanks.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.