Highlighted
Absent Member.
Absent Member.
335 views

Can i fill a table subformat with an array?

If i have an array on javascript can i fill a table?

my array is matriz[x][y]

regards!

0 Likes
6 Replies
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Can i fill a table subformat with an array?

Sorry, not sure what you're asking.

I understand you've got a javascript array.  Are you looking for something to happen to that array when the user clicks the "Fill" button?  Are you expecting the data in that array will go somewhere when you click "Fill"?  

And does your table subformat reference a field in the record you're looking at?  Or is it a virtual join to a list of other records?

The short answer is - yes, you can take a javascript array and use that to populate data in fields within your record, but I'm not 100% clear on the ask, so I'm not sure how to give any specific direction.

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Can i fill a table subformat with an array?

Sorry if I did not explain well, my English is not the best.

I have a structure like var array $structure = [{ a1, a2 , a3 } ] . I Fill This structure With an javasript , then a i have to load this records in control table , but i dont know how i do the reference to the var in the table control, Because if i put $structure in the field property nothing happens.

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Can i fill a table subformat with an array?

If you've got a javascript structure, do you have named pairs - like name/value to reference within your structure?  If so, you'd have something like:

var aFile = new SCFile("whateverYourTableYou'reTryingToCreate")
aFile.field1 = vars.$structure.field1
aFile.field2 = vars.$structure.field2
(etc...)

I'm just unclear on if you've really got a structure, or if you've got an array.

Can you share the javascript you're using to create your structured array?

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Can i fill a table subformat with an array?

This is the javascript, i need load the result into a coltrol table or subformat:

var OcmqFile = new SCFile ("activityocmq");

var query = OcmqFile.doSelect("number=\"XXXX\"");

if(query == RC_SUCCESS){ var nCount = OcmqFile.doCount("number=\"" + OcmqFile.number + "\"");

var matriz = new Array();

for (var i = 0; i < nCount; i++){

matriz[i]=new Array();

var OperatorFile = new SCFile("operator");

var query = OperatorFile.doSelect("name=\"" + OcmqFile.operator + "\"");

var name=OperatorFile.full_name; name = name.replace(/,/g, "");

matriz[i][0] = name;

OcmqFile.getNext();

}

}

0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Can i fill a table subformat with an array?

Ok; I'm not clear on why you're trying to load this into an array, and then load it back somewhere.

What it _looks_ like you're trying to do is update the Operator table with data from your ocmq activity table (which seems like an odd thing to do).  What I _think_ you want to do is update your ocmq table with data from your operator table.

In either way, I'm not sure why you're storing data to an array first, or why you're attempting a structure array...

Your script starts at the activityocmq table to list of activity records for a specific ocmq.  Then you go to the operator table to get the full name of the operator who performed the action that generated the activityocmq record...  But why do you populate that value into an array inside an array?  

So let's take a step back.  What is this supposed to accomplish?  What's the end goal?

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Can i fill a table subformat with an array?

Well, im trying to get the full name of the operator in the activityocmq and fill a field table with that. Because in the activityocmq doesnt existe that field. I dont want to create a new field for that, that why i take that información from the operator table.
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.