Concatonate 2 columns in on subfile column?

Use this board to ask questions or have discussions with other Genie users.
rmarsh
Profound User
Posts: 56
Joined: Tue Jan 20, 2015 4:28 pm
First Name: Raymond
Last Name: Marsh
Company Name: Cracker Barrel Old Country Sto
Phone: 615-235-4215
Address 1: PO Box 787
City: Lebanon
State / Province: Tennessee
Zip / Postal Code: 37088
Country: United States
Contact:

Concatonate 2 columns in on subfile column?

Post by rmarsh »

I have a text column in a sub-file that Genie is splitting into two distinct fields in HTML.

Example:

Code: Select all

Restrictions     
CODE5            
CODE5
                 
CODE5            
CODE5 CORP       
       
CODE5
The things is, on row 5 "CODE5" is in D_19_60 and "CORP" is in D_19_72. When I map out my subfile grid I don't know how to put both fields in the same column in the grid.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Concatonate 2 columns in on subfile column?

Post by Scott Klement »

Do you want to concatenate these two fields in Genie, but keep them as separate fields in the underlying green-screen? For input fields, you could highlight both fields, then right click, and choose "combine into text area" -- but it sounds like these are output fields. For output fields, you could make the first one longer (by dragging it's edge to make it wider) and hide the second one. Then, in the 'onload' of your screen, you could do pui.set("FIRSTFIELD", get("FIRSTFIELD") + " " + get("SECONDFIELD")); so that the first field contains the contents of both fields... since these are output-only fields, there's no need to split them apart again when the screen is submitted. (If it were an input field, you'd need to do that, unless you use the 'combine into text area' function, which does it for you.)

Or do you want to keep them as two separate fields, but put both fields into a single column in the grid? This is easy to do when you turn off "detect subfiles" (in the screen-level properties) and drag in your own grid. When you do that, you can just drag the column edges to wherever you want them to be, so you can easily enclose multiple fields that way.
rmarsh
Profound User
Posts: 56
Joined: Tue Jan 20, 2015 4:28 pm
First Name: Raymond
Last Name: Marsh
Company Name: Cracker Barrel Old Country Sto
Phone: 615-235-4215
Address 1: PO Box 787
City: Lebanon
State / Province: Tennessee
Zip / Postal Code: 37088
Country: United States
Contact:

Re: Concatonate 2 columns in on subfile column?

Post by rmarsh »

It is output only so I just want to show the text of the two fields in the last column of the grid in Genie. It is really one field in the subfile row but it got split up by Genie. Probably because the "CORP" doesn't even show up on the first page. The second pos 72 field is a hidden field on most screens.

Also, this is a grid-subfile which I manually added. Detect subfile if false. The sub-file can be searched and if the is 0 or 1 row it was not rendering as a sub-file.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Concatonate 2 columns in on subfile column?

Post by Scott Klement »

If it's just one field, but Genie is splitting it into two, it must mean that you have inserted a hex code into the field? Maybe you stuck one in there to change the color or one of the other display attributes in the middle of the field? If you do that, Genie will not be able to tell that there's only one field there. The attribute code (hex code) is what tells it where output fields stop/start.

Did my suggestions, above, help? If they did, great! If not, please send me a Ctrl-F9 JSON file so I can see exactly what you're looking at.
rmarsh
Profound User
Posts: 56
Joined: Tue Jan 20, 2015 4:28 pm
First Name: Raymond
Last Name: Marsh
Company Name: Cracker Barrel Old Country Sto
Phone: 615-235-4215
Address 1: PO Box 787
City: Lebanon
State / Province: Tennessee
Zip / Postal Code: 37088
Country: United States
Contact:

Re: Concatonate 2 columns in on subfile column?

Post by rmarsh »

No, nothing weird is going on. I just didn't understand what the the screen was doing. It is actually 4 separate fields all under the column heading "Restrictions" I tried the first suggestion and it works fine for the output fields. but when I add the field to the subfile, the value reverts or the field length reverts. Either way I can't see the second column value.

I used the second suggestion and that worked fine. I could've defined 4 separate columns but then I would've have to get clever with the heading.
Last edited by rmarsh on Fri Feb 20, 2015 4:25 pm, edited 2 times in total.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Concatonate 2 columns in on subfile column?

Post by Scott Klement »

Maybe you need to make the changes after you've added the fields to the subfile?

I hate to be a pest about this, but, can you post a Ctrl-F9 JSON file so I can see what you're seeing?
rmarsh
Profound User
Posts: 56
Joined: Tue Jan 20, 2015 4:28 pm
First Name: Raymond
Last Name: Marsh
Company Name: Cracker Barrel Old Country Sto
Phone: 615-235-4215
Address 1: PO Box 787
City: Lebanon
State / Province: Tennessee
Zip / Postal Code: 37088
Country: United States
Contact:

Re: Concatonate 2 columns in on subfile column?

Post by rmarsh »

Here is the json file. Thanks Scott.

btw: This version is the one where I put all 4 fields on each row over the subfile. I didn't have time to put it back with the extended field, concatonating the others into it. They're kicking us out on account of weather so I'll try to get on in an hour or so.
Attachments
json (5).txt
(14.46 KiB) Downloaded 469 times
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Concatonate 2 columns in on subfile column?

Post by Scott Klement »

Ray,

I took a look at this, and not sure what the problem here was (maybe the problem was fixed when you added your own subfile grid instead of using auto-detect?) but it seemed to work okay for me.

There are some bugs in the code that you have commented-out in the onload of this screen, though. For example, row 19 looks like this:

Code: Select all

//pui.set("D_19_54", get("D_19_54") + " " + get("D_19_60") + " " + get("D_20_66") + " " + get("D_20_72"));
Probably, this was an error when copy/pasting, but, of course the last two "get" calls on this line should be for D_19_66 and D_19_72, but you have row 20 instead.

The other problem with this code is that it doesn't hide the elements. You are combining the data from three fields into one field, so you don't want the 2nd and 3rd fields to still be shown, you want to hide them. My suggestion to avoid the copy/paste errors and to make it easier to add multiple lines (since you'll need another line of code to hide the other elements, and another one to change the width) would be to put it in a loop so you only need to code everything once.

For example:

Code: Select all

for (var row=7; row<=22; row ++) {
  var field1 = "D_" + row + "_54";
  var field2 = "D_" + row + "_66";
  var field3 = "D_" + row + "_72";
  hideElements(field2, field3);
  applyProperty(field1, "width", "185px");
  //getObj(field1).style.border = "thin solid #000000";
  pui.set(field1, get(field1) + " " + get(field2) + " " + get(field3));
}
Note: the commented-out code above draws a line around the concatnated field, makes it easier to see that the new width has been set properly when testing.

Anyway, you probably don't need this, since you already took my earlier 2nd suggestion about putting both fields into a wider subfile column, so everything here should be good -- but thought you might be curious.
rmarsh
Profound User
Posts: 56
Joined: Tue Jan 20, 2015 4:28 pm
First Name: Raymond
Last Name: Marsh
Company Name: Cracker Barrel Old Country Sto
Phone: 615-235-4215
Address 1: PO Box 787
City: Lebanon
State / Province: Tennessee
Zip / Postal Code: 37088
Country: United States
Contact:

Re: Concatonate 2 columns in on subfile column?

Post by rmarsh »

Thank you Scott. I do appreciate the information. I will play around with it if only because I'd like to get it to work for my own satisfaction.
dkmccammon
Profound User
Posts: 48
Joined: Wed Apr 12, 2017 4:44 pm
First Name: Darin
Last Name: McCammon
Company Name: NAICO
Phone: 4052584301
Address 1: 1010 Manvel Ave
City: Chandler
State / Province: Oklahoma
Zip / Postal Code: 74834
Country: United States
Contact:

Re: Concatonate 2 columns in on subfile column?

Post by dkmccammon »

If it's just one field, but Genie is splitting it into two, it must mean that you have inserted a hex code into the field? Maybe you stuck one in there to change the color or one of the other display attributes in the middle of the field? If you do that, Genie will not be able to tell that there's only one field there. The attribute code (hex code) is what tells it where output fields stop/start.

So question here, it was noted that the (hex code) is what tells Genie where output fields stop/start. Is there a way that we can manually set where the field stops, like we can manually set where the output field starts (and is even required when making your own grid)?

I have a subfile that highlights(white letters vs green letters) certain words in the field and these words and locations are random depending on what is in the string. The widths of the boxes that would house these words would also be random depending on what is contained in the field. So putting a grid on top of the boxes would not work. The option to combine fields is not an available option when right clicking, but then again on the green screen it is not multiple columns, it is one column. Hope this makes sense, and I hope there is a way to handle this.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest