Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I have a field that contains values separated by semi-colons. I need to take each of those values and turn them into their own records, maintaining the data from the other fields in the original record. For Instance... I have the following fields:

ProductNumber Code Keywords

Sample values would be...

5522 IM Boards; Dry Erase; 3M

And I want it broken into the following:

5522 IM Boards

5522 IM Dry Erase

5522 IM 3M

I'm trying to create some form of looping script that will do this to a table of 50,000 records. : Help!

I need more examples...

1) Code is always ONE word ?

2) There is really a space between the semi-colon and the next word ?

If the answer is yes to all my questions, you can try:


Freeze Window

Set Variable [ $Original ; Value: YourTable::YourOriginalField ]

Go To Layout [ "TheNewTableLayout" ]

Loop

Set Variable [ $count ; Value: $count + 1 ]

Set Variable [ $record ; Value: GetValue ( $Original ; $count ) ]

Set Variable [ $Keywords ; Value: Substitute ( RightWords ( $record ; WordCount ( $record ) - 2 ) ; ";" ; ¶ ) ]

Exit Loop If [ $count > ValueCount ( $Original ) ]

New Record/Request [ ]

Set Field [ NewTable::ProductNumber ; MiddleWords ( $record ; 1 ; 1 ) ]

Set Field [ NewTable::Code ; MiddleWords ( $record ; 2 ; 1 ) ]

Set Field [ NewTable::Keywords ; Trim ( GetValue ( $Keywords ; 1 ) ) ]

Duplicate Record

Set Field [ NewTable::Keywords ; Trim ( GetValue ( $Keywords ; 2 ) ) ]

Duplicate Record

Set Field [ NewTable::Keywords ; Trim ( GetValue ( $Keywords ; 3 ) ) ]

End Loop

Go To Layout [ original layout ]

That doesn't look right: are there always 3 keywords?

I believe it should be:


Show All Records

Go to Record [ First ]

Freeze Window

#

Loop

Set Variable [ $product ; Value: YourTable::ProductNumber ]

Set Variable [ $code ; Value: YourTable::Code ]

Set Variable [ $key ; Value: Substitute ( YourTable::Keywords ; ";" ; ¶ ) ]

#

Go To Layout [ "TheNewTableLayout" ]

Set Variable [ $i ; 1 ]

#

Loop

Exit Loop If [ $i > ValueCount ( $key ) ]

New Record/Request

Set Field [ NewTable::ProductNumber ; $product ]

Set Field [ NewTable::Code ; $code ]

Set Field [ NewTable::Keyword ; Trim ( GetValue ( $key ; $i ) ) ]

Set Variable [ $i ; Value: $i + 1 ]

End Loop

#

Go To Layout [ original layout ] 

Go to Record [ Next; Exit after last ]

End Loop

See also an alternative method here:

http://fmforums.com/forum/showpost.php?post/358232/

I don't know.

But if they are more, a nested Loop will solve.

Didn't YourTable contain only a text field with many values inside ?

(not in this order)

I have the following fields: ProductNumber Code Keywords

I have a field that contains values separated by semi-colons.

I need to take each of those values and turn them into their own records, maintaining the data from the other fields in the original record.

And I should add that one the two fields, ProductNumber and Code, is probably redundant in the new table - but I don't know for sure which one.

Edited by Guest

I (mis)understand that he had only one text field ( probably imported ) that contains values like this:

5522 IM Boards; Dry Erase; 3M

5523 IN Ccccc; DD DDDD; 1A

and wish to obtain, in a new table, new records like this:

5522 IM Boards

5522 IM Dry Erase

5522 IM 3M

5523 IN Ccccc

5523 IN DD DDDD

5523 IN 1A

  • Author

I'm sorry if I wasn't clear.

I have 3 field in this imported table.

1. ProductNumber (text)

2. Code (text)

3. Keywords (text)

The keyword field contains separated by '; '

For instance, "Boards; 3M Markers; Erasers;

The keyword field could contain any number of keywords, each separated by a semi colon and a space.

ProductNum, code, keywords

53241, IM, Boards; 3M Markers; Erasers; sticky notes; mounting kits;

55332, IB, 3-ring binders; multiple-uses; 12 color choices;

I would like my end result to be:

ProductNum, code, keyword

53241, IM, Boards

53241, IM, 3M Markers

53241, IM, Stickie Notes

53241, IM, Mounting Kits

55332, IB, 3-ring binders

55332, IB, multiple-uses

55332, IB; 12 color choices

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.