You are viewing limited content. For full access, please sign in.

Question

Question

Populate table based off collection field?

asked on April 28, 2020

New to LF, feeling a bit lost. A lot of our business procedures revolve around 118 different budget codes. Education has to have different codes for grants and other federal funding. It's tedious, but don't really have any say in the matter.

 

Ex. of budget codes drop-down menu. 

 

 

So far we have 2-3 forms that I have set up to act in the following matter. A collection field with the information needed, then they can add more and more trips or occurrences. (see below)

 

I can't seem to find a way to populate a table based off a collection response, i found some code to add a new row for every new budget selected, but not pass through info.

 

Then calculate the total of each budget code.

 

EG all 315 = 100

all 317 = 200

Id want a table that has column returning the full value of drop-down, and then added a total of all 315's. Next row is 316, so on and so forth.

 

I could do SUMIFs for each one, and hide if they are empty the problem is there's 118 different budget codes. so there would be 118 row table with most of it hidden 95% of the time.

Is there an easier way of doing this?

 

 

0 0

Replies

replied on May 4, 2020

For those in the future the fields for SUMIF must be number fields. 

 

Thanks Steve, the real MVP

1 0
replied on May 1, 2020

Hi Dustyn

Just to clarify, in the collection there could be multiple lines for Budget Code 303, 305 and 312 as an example.

The table below would be a subtotal for each of the Individual codes, correct?

Do the Budget Codes exist in a DB Table?
Fyi, if they did you could use a type ahead field as a drop down in a single line field as opposed to the long drop down menu where you may have a lot of scrolling.

Also, I think I could easily solve your problem using the DB table, a formula and a Field Rule. Otherwise I can see needing to use JS to pull the unique info from the Colllection.

0 0
replied on May 1, 2020

In the collection, it would be 1 budget per entry, but there could be multiple occurrences of said budget. EX. Trip 1 & 2 are budget 316 but trip 3 is 317.

 

I am working with our DB admin to find out if they do. The problem we have so far is a lot of older budgets are in there as well. If the example above the 3 digit fields are the constant in all the budget number. The numbers to the left/right of it change per year and such. EG 00-315 is 2020's 315, while 19-315 would be last years.

 

Could you further explain the DB Table formula and field rule solution? Worst case i can create a new Table that has the relevant budget codes and pull from that. I have a list of the ones we need.

0 0
replied on May 1, 2020

Here is how I would do something like this

0 0
replied on May 1, 2020

You can do this with your dropdown if you want, I just like the functionality of the Type ahead with long Drop downs. The example below uses a Single Line field filled by a lookup

Here is the SQL table I created as an example

0 0
replied on May 1, 2020

My Form Layout looks like this, same as you, Collection on the top, Table on the bottom


Field Rules (You will get a Yellow warning with this as it's hiding a field used in the Logic. There is a way to get around this by adding another field but it will work as you hope as is.

Lookups. The Lookups are used to Fill the Budget Code field with all of the Codes from the DB, and as well as the Totals Table. When the Budget Code is entered in the top form, it will populate the Full Code.

I'm not sure if that is the way you wanted it but it made sense to me

0 0
replied on May 1, 2020

For Calculations I have the following in the Totals Field in the Total Table

=SUMIF(Budget.FullCode,INDEX(Totals.BudgetCode,ROW()),Budget.Disbursement)

In short, SUM the Disbursement field when the Budget FUllCode matches the code in the Budget Code in the Totals Table Row

0 0
replied on May 1, 2020

Oh man, you are a life saver, this seems WAY easier. I will give it a shot Monday when i am back at the office! Thank you so much!

0 0
replied on May 1, 2020

Little video of it in action

Budget.mp4 (145.59 KB)
0 0
replied on May 4, 2020

So I created my on DB for now just to play around with it. I stuck with the single line as I agree it looks nicer and not as jarring. 

 

I got most of it down, just the totals sum isn't working. It's also PRETTY laggy and not as smooth as yours, but that might be the sum field messing up some how. 

 

I went ahead and just created a new form to play with it and modeled it after your example. Only difference I can see is my collection variables have a collection. in front of their name.

 

Here's what my sumif statement is. Which if I understand it correctly (explaining helps me learn)

 

=SUMIF(Collection.Full_Budget_Code,INDEX(Totals.Table_BudgetCode,ROW()),Collection.Disbursement_Amount)

 

 

This will add the Disbursement amounts from collections, where the full budget code (collection) matches the full budget code row in my table. Correct?

 

The last pic is what I see when I preview the form

 

 

 

0 0
replied on May 4, 2020

Hi Dustyn, I don't see any Rows in your Table. The table needs to be populated via lookup from the same DB Table to create the Full Code list. This is what the formula is expecting. In the lookup section about, it was the 3rd lookup

0 0
replied on May 4, 2020

Sorry Yeah i took off the hide rule after the fact. Here's a new Picture.

 

0 0
replied on May 4, 2020 Show version history

Can you confirm your variables, especially "Table_BudgetCode" as it doesn't follow the way you defined your other variables. Never mind, it would give you an error if the variable didn't exist

=SUMIF(Collection.Full_Budget_Code,INDEX(Totals.Table_BudgetCode,ROW()),Collection.Disbursement_Amount)
0 0
replied on May 4, 2020 Show version history

Yeah, I thought that too, so I started messing with them as well. Just starting to mirror yours to get it to function at this point. See the new Sumif and Variables below. (and lookup rules just in case)

 

=SUMIF(Budget.FullCode,INDEX(Totals.BudgetCode,ROW()),Budget.Disbursement)

 

Collection Variables:

 

Table Variables:

 

0 0
replied on May 4, 2020

Try this, if it works I'll explain 

=SUMIF(Budget.FullCode,INDEX(Totals.BudgetCode,ROW()),Budget.Disbursement)

0 0
replied on May 4, 2020

Negative, but isn't that the same thing I posted? 

0 0
replied on May 4, 2020 Show version history

Sorry, I missed that in trail.

After changing the Variable Names, did you refresh the page?

Whenever creating variables or updating them, it's important to refresh the page as it's Forms way of saving the changes to their code.

0 0
replied on May 4, 2020

I didn't just did still no dice.

 

I think something else is up though. For kicks, I just made a new single-line box, before the table, and told it to just =SUM(Budget.Disbursement) and added a few collections with JUST disbursement filled out and that box never changed. 

 

https://i.imgur.com/JK58B1h.png

0 0
replied on May 4, 2020

Want to have a web meeting, I think it would be quicker

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.