- PowerApps Community
- News & Announcements
- News & Announcements
- General
- General Discussion
- Common Data Services
- Common Data Service for Apps
- Best Practices
- Administering PowerApps
- Creating Apps
- Expressions and Formulas
- PowerApps Component Framework (Preview)
- Galleries
- Community Apps Gallery
- Video Gallery
- MBAS Gallery
- Ideas
- PowerApps Ideas
- User Groups
- Professional Connections & Networking
- Community Blog
- PowerApps Community Blog

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- PowerApps Community
- Forums
- General
- General Discussion
- First, Last, FirstN and LastN???!!!

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

asdeev

Level: Powered On

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-22-2019
03:08 PM

How can I make this work.

After trying so many different ways I came up with this.

I have a datacard called Job steps and I have 10 textinputs as shown below. (Also see pic for reference)

**textinput 1**

**textinput2**

**textinput3**

**textinpit 4**

**.**

**.**

**.**

**.**

**textinput10**

I want the textboxes to get back their default values when user opens the submitted form in edit mode.

I used **If(!Exisitng, "1.", First(Split(ThisItem.JobSteps,"|")).Result).** -- - I am checking if it is not an existing form then have 1. in the textinput, if not (if its edit form) have the defaulted value that the user submitted when they created this form.

Technically the above formula works for my First TextInput but how can I get back the other TextInput information?

I tried the formula (See below) For the second textinput but I am not sure how to make this work.

My patch function for this coloumn is

**jobsteps: Concatenate(TextInput7.Text,"|", TextInput8.Text, "|", TextInput14.Text)**

**Any help is highly appreciated!!!**

Solved! Go to Solution.

2 ACCEPTED SOLUTIONS

Accepted Solutions

PaulD1

Super User

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-22-2019
04:41 PM

If I understand correctly, you want to get back element N from an array.

For element 1 you are using: **If(!Exisitng, "1.", First(Split(ThisItem.JobSteps,"|")).Result)**

For element 2 you can use a combination of Last and FirstN, e.g.

**If(!Exisitng, "1.", Last(FirstN(Split(ThisItem.JobSteps,"|"),2)).Result)**

So you are saying, return the first 2 items and give me the last one.

To get element 3 would be:

**If(!Exisitng, "1.", Last(FirstN(Split(ThisItem.JobSteps,"|"),3)).Result)**

KroonOfficeSol

Level 10

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-22-2019
03:36 PM

For the second and so on you could try

Last(FirstN(Split(ThisItem.JobSteps,"|"),2))).Result)

Change the 2 to 3,4,5,6,7 and so on.

Should work I would think.

Paul

5 REPLIES 5

asdeev

Level: Powered On

First, Last,, FirstN, LastN??!! Please help

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-22-2019
03:11 PM

After trying so many different ways I came up with this.

I have a datacard called Job steps and I have 10 textinputs as shown below. (Also see pic for reference)

**textinput 1**

**textinput2**

**textinput3**

**textinpit 4**

**.**

**.**

**.**

**.**

**textinput10**

I want the textboxes to get back their default values when user opens the submitted form in edit mode.

I used **If(!Exisitng, "1.", First(Split(ThisItem.JobSteps,"|")).Result).** -- - I am checking if it is not an existing form then have 1. in the textinput, if not (if its edit form) have the defaulted value that the user submitted when they created this form.

Technically the above formula works for my First TextInput but how can I get back the other TextInput information?

I tried the formula (See below) For the second textinput but I am not sure how to make this work.

My patch function for this coloumn is

**jobsteps: Concatenate(TextInput7.Text,"|", TextInput8.Text, "|", TextInput14.Text)**

**Any help is highly appreciated!!!**

asdeev

Level: Powered On

First, Last, FirstN, LastN??!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-22-2019
03:13 PM

After trying so many different ways I came up with this.

I have a datacard called Job steps and I have 10 textinputs as shown below. (Also see pic for reference)

**textinput 1**

**textinput2**

**textinput3**

**textinpit 4**

**.**

**.**

**.**

**.**

**textinput10**

I want the textboxes to get back their default values when user opens the submitted form in edit mode.

I used **If(!Exisitng, "1.", First(Split(ThisItem.JobSteps,"|")).Result).** -- - I am checking if it is not an existing form then have 1. in the textinput, if not (if its edit form) have the defaulted value that the user submitted when they created this form.

Technically the above formula works for my First TextInput but how can I get back the other TextInput information?

I tried the formula (See below) For the second textinput but I am not sure how to make this work.

My patch function for this coloumn is

**jobsteps: Concatenate(TextInput7.Text,"|", TextInput8.Text, "|", TextInput14.Text)**

My datasource is SQL and Jobsteps is one of the coloum in it.

**Any help is highly appreciated!!!**

KroonOfficeSol

Level 10

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-22-2019
03:36 PM

For the second and so on you could try

Last(FirstN(Split(ThisItem.JobSteps,"|"),2))).Result)

Change the 2 to 3,4,5,6,7 and so on.

Should work I would think.

Paul

PaulD1

Super User

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-22-2019
04:41 PM

If I understand correctly, you want to get back element N from an array.

For element 1 you are using: **If(!Exisitng, "1.", First(Split(ThisItem.JobSteps,"|")).Result)**

For element 2 you can use a combination of Last and FirstN, e.g.

**If(!Exisitng, "1.", Last(FirstN(Split(ThisItem.JobSteps,"|"),2)).Result)**

So you are saying, return the first 2 items and give me the last one.

To get element 3 would be:

**If(!Exisitng, "1.", Last(FirstN(Split(ThisItem.JobSteps,"|"),3)).Result)**

asdeev

Level: Powered On

Re: First, Last, FirstN and LastN???!!!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

01-23-2019
07:22 AM