Get a tabular feeling in InfoPath

Hi everyone!

Ok, as the title says I will describe and show you have you could do to give your InfoPath form that little extra that sticks out.

As you already might know we now have the possibility to use pictures as buttons in InfoPath 2010.

The final result will look something like this:

It consists of six pictures altogether, because we have a darker image that will be chosen as hover-button and as the active-button. We also have three views that we can toggle by selecting these tabs.

The tabular area is divided in five cells, a starting and an ending cell and three cells that holds each one of the tabs.

The starting and ending cells both have a background color of RGB: 192, 210, 218 and the cells in the middle have RGB: 205, 219, 225 that will match these pictures. Putting a background color also gives a smoother transition when you hover the buttons.

Start by creating three views named “Requestor”, “Project” and “Financials”.

Then add three picture buttons like this:

For each one of the buttons and cells, set all margins to 0 (zero) so that looks like this.

Now choose the first view, in this case “Requestor” and give the home-button the darker picture and leave the hover button empty.

As you can see InfoPath gives the picture a name of its own.

For the other two buttons in this view, add the brighter picture as its default and the darker as the hover button.

When you have finished all three buttons make a preview to make sure the tabs change when you hover them.

Now we are going to add some rules to the buttons.

On the view “Requestor” leave the first button as is. On the second button add a rule with an action that switches to the view “Project” and on the third button an action that switches to the view “Financials”.

Now do the same thing for the other two views but of course, have their home-buttons dark without a hover button and so on.

Make a preview and make sure you end up in the correct view.

CU

/SPNiax

Advertisements

What to do with trailing zeros from SharePoint

Hi everyone!

It’s been a long time since the last post, but sometimes one has to take care of things like the family. Ok, so now when that is done we could start having some fun again 🙂

I would like to start with a small and quick one.

Let’s say you have a drop down (field2) in your form that lists objects from a list in SharePoint. The list has got two columns, Title and Number.

The value for the drop down is set to Number and the Display name is set to Title.

Then you need to set another field (field3) in your form to the value of the chosen object,.

Set the Value of field3 to be same as field2

that’s when you will see that the number of the object will have lots of trailing zeros.

An easy way to get rid of these zeros is to insert a formula in front of the field2 value of sum.

this way the zeros will be gone.

Happy InfoPathing!

CU!

/SPNIAX


Working with Lookup columns in SharePoint list forms with InfoPath

Hi everyone!

I would like to show you how to work with lookup columns between lists when you i.eg. would like to summarize the amount of orders that a sales person have made.

So we have a list called “Sales persons” with five columns, “Name”, “Region”, “Office”, “Sales ID” and “TotalAmount”.

We also have a list called “Sales orders” with three columns, “Product”, “Amount” and “Sales ID”.

In this list the column “Sales ID” is a lookup column to “Sales ID” in “Sales person”.

We also have a data connection to retrieve these three fields from “Sales orders”.

When we open a form for a sales person we want to see the total amount of orders that’s been made by that person. When we first look at this it looks quite simple. The “TotalAmount” should be the sum of “Amount” where “Sales ID” equals “Sales ID”, right?

The problem here is when we work with lookup columns it is not actually the value of the look up that is brought to your repeating table by your data connection, it is in fact the “ID” of the item in that list.

So to filter which amounts to summarize we should do like this:

The “TotalAmount” should be the sum of “Amount” where “ID” equals “Sales ID”.

Now when we open the form of a sales person, we could see the total amount that person has sold for.

Hope this helps someone!

CU

/SPNiax


Cascading drop-downs and images

Hi everyone!

You all know the great thing with InfoPath, how easy it is to work with cascading drop-downs. I would like to share one more thing with you in this area, how you could show different images depending on your choice in the drop-down.

I will very shortly describe how to set up cascading drop-downs, the main thing here is to give you the way to show the different images.

The drop-downs (2) is received from a SharePoint list with three columns “Tillverkare”, “Modell” and “Bild” (that is Manufacturer, Model and Picture, in english).

The configuration of the first drop-down looks like this.

The second drop-downs configuration looks like this.

Notice the lower circle, the next picture will show what to do when you press the button of the upper circle.

  1. Press the button to choose from your secondary data source
  2. A difference from the first drop-down is that you need to add a filter, so press the button “Filter data…”
  3. Add a filter where you say that Tillverkare (Main data source) is equal to Tillverkare (second data source)

 

Ok, so now lets move on to how to make this true for an image as well.

My list in SharePoint also has a third column called “Bild” (picture in english) and we want this picture to be changed depending on what Modell we choose.

Now lets add a Picture control to your form and open the properties of the picture.

You will see a default XPath to the picture control it self. Press the button to the right of the XPath and point to your secondary data source and your picture column. Now, as you see where the cross is, we would have wanted a button to add a filter, but it’s gone 😦

Instead we will use the filter from drop-down 2 as I will show you in a minute. For now, highlight your picture column in your data source and press OK. Also notice that you should set the picture to be Read only.

Open the properties of the second drop-down and copy the the part of the XPath that holds the filter.

[xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/my:SharePointListItem_RW/my:Tillverkare = d:Tillverkare]

Add this at the end of the XPath for the picture control and replace “Tillverkare” with “Modell”. Now you have a filter for you picture control as well.

To avoid having to see the picture controls icon in the form when no “Modell” is choosen, put a formatting rule on it that has the condition “when Modell is blank” hide this control.

When you publish this form you will probobly get an error that looks like this.

But go ahead and publish anyway and you will see that it works.

For a full blog post about setting up the cascading drop-downs you should read this blog post at Koobar’s Point.

I hope this helps someone sometime…

CU!

/SPNIAX


Query and filter on related columns

Hi everyone!

I want to give you a way to filter a repeating table with the help of a drop down.

 

Let’s say you have a list with with a column called Requests and one column that is called Defects. You could have multiple defects for a request and now you only want to show thoose defects for the request you have choosen.

 

First add a data connection to receive these three columns from your list.

On your form, add a drop down and configure it like this.

 

 

Now add this secondary data source as a repeating table to your form and delete those columns you don’t need to show in the form. Deleting them from the form doesn’t mean that you delete them from the data source, they will still be there if you need them. Afterwards it could look like this.

 

Let us add the rule to the repeating table that will do the trick.

Highlight the repeating table and click the button Manage rules in the ribbon. Add a new Formatting rule that looks like this.

The condition says: When”Request” in the secondary data source “is not equal to” the “MainRequest” in the main data source.

Now when you test the form you will be able to see only those defects that belongs to the request you choose.

CU!

/Niax


Multiple submits

Hi everyone!

I thought I would give you a way to handle multiple submits in a form. Lets say you have a form that should be filled by both students and ordinary attendees. There are some fields that are specific to the students like name of school and name of education and for the attendee we might have fields like title and name of company. When they make the submit we want to make sure all required fields are filled, but only the required fields for that kind of person.

First of all the person should make a decision if he is a student or an attendee, the form could look like this.

When the person clicks one of the buttons a field named listener is set to Attendee or Student. This decides which fields (or sections) that are displayed on the form. To handle the submit and validation of fields I have two submit buttons that looks the same but have different rules applied to them. They are both hidden if listener is blank or is set to the other buttons value.

Here is how it looks in design mode where both submit buttons can be seen and you also can see the message that is thrown if not all required fields are filled.

I think it’s a pretty easy way to accomplish what I was looking for and should be pretty simple for any one to use as well.

CU!

/Niax


Add a button to a repeating table to copy row data

Hi everyone!

I will show you how to add a button to a repeating table and be able to copy information from that row to other fields.

Create a list in SharePoint and name it Location with three columns, Title, Region and City.

Add a data connection to your form to receive information from this list in SharePoint. Now when you have your repeating table as a secondary source, highlight it and drag it to your form.

Put your cursor somewhere in the column for ID, right click and choose DeleteColumns, now you only have the Title, Region and City columns left.

Now put the cursor somewhere in the City column, right click and choose Insert – Columns to the right.

It should now look like this

Now add a button in the field next to the City field.

Add three Text Box fields somewhere in your form and name them MyTitle, MyRegion and MyCity.

Highlight the button and click Manage Rules in the ribbon. Create a new Action rule to set a field’s value. It should look like this.

The Value is built by adding the function current(), then a slash “/” and lastly, add the field Title from your secondary source Location.

Repeat this step twice so that you get a value for each of your three fields. You should now have three actions in your rule, like this.

That’s it, this is how it could look.

CU

/Niax