Jump to content

Too complex me :)


Babem
 Share

This topic is 2921 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hi

 

I have lot of simple comma separated text string than this here:

 

-> Logo_ERNI;SMCStandardkabel;SMCStandardkabel_Z;

-> SO8;SO8_Z;

 

And I would like to convert to this:

 

-> /L/o/Logo_ERNI.jpg;/S/M/SMCStandardkabel.jpg;/S/M/SMCStandardkabel_Z.jpg;

-> /S/O/SO8.jpg;/S/O/SO8_Z.jpg;

 

 

I managed to reach away this point:

 

-> /Logo_ERNI.jpg;/SMCStandardkabel.jpg;/SMCStandardkabel_Z.jpg;

-> /SO8.jpg;/SO8_Z.jpg;

 

I don't know how to continue.

Please let somebody help to solve this problem, if necessary, I send the partial solution.

THX

 

Link to comment
Share on other sites

Try this Custom Function:

 

// Customize ( theString ) =

Case ( 
  Right ( theString ; 1 ) ≠ ";" ; 
  "String malformed!" ;
  Let ( [
    pos = Position ( theString ; ";" ; 1 ; 1 ) ; 
    rem = Length ( theString ) - pos ;
    thePart = Left ( theString ; pos - 1 ) ;
    res = Left ( thePart ; 1 ) & "/" & Middle ( thePart ; 2 ; 1 ) & "/" & thePart & ".jpg;"
    ] ;
    res & Case ( rem ; Customize ( Middle ( theString ; pos + 1 ; rem ) ) )
  )
)
Link to comment
Share on other sites

Hi baben and welcome to the forums,

 

Hi

 

I have lot of simple comma separated text string than this here:

I don't know how to continue.

Please let somebody help to solve this problem, if necessary, I send the partial solution.

THX

Let’s start by updating your profile to reflect your current version of FileMaker Pro, platform, and operating system. Here is a quick link to get you started My Profile

 

I’m not sure from your sample what to suggest. Why not attach an actual copy of the text.

 

A Custom Function requires FileMaker Pro Advance it will be helpful to see your setup.

 

Lee

Link to comment
Share on other sites

What is the purpose of this conversion? It seems you are converting one meaningless (in Filemaker terms) string into another just as meaningless.

 

It seems like you should take this opportunity to separate the semi-colon-delimited values into individual records. Then not only would the calculation of the path become fairly trivial; you would also be able to keep the original names, in case your filing scheme changes one day.

 

 

--

P.S. What does the string:

-> 

represent in your code examples?

Link to comment
Share on other sites

  • Newbies

What is the purpose of this conversion? It seems you are converting one meaningless (in Filemaker terms) string into another just as meaningless.

 

It seems like you should take this opportunity to separate the semi-colon-delimited values into individual records. Then not only would the calculation of the path become fairly trivial; you would also be able to keep the original names, in case your filing scheme changes one day.

 

 

--

P.S. What does the string:

-> 

represent in your code examples?

Our company get every day in a huge database with picture names. But we need exact path of the picture.

Excuse me my weak English knowledge, but this important for me.

 

( etc. in the cell "Shop_cikkadatok::pic" I have some names "Picture01;Picture02;" and I would like convert to "/P/i/Picture01.jpg;/P/i/Picture02.jpg;")

Left (

Substitute
                  (
                   (
                    "/" & Substitute
                     (Shop_cikkadatok::pic ; ";" ;".jpg;" )
                   )
                    ;";";";/"); 
                  Length (
                    Substitute
                       (
                         (
                           Substitute
                              (Shop_cikkadatok::pic ; ";" ;".jpg;" )
                        )
                         ;";";";/"))
)

With this script my partial result now this: "/Picture01.jpg;/Picture02.jpg;"

How to continue?

 

Thanx for all

Link to comment
Share on other sites

  • Newbies

Hi eos, thanx your help.

 

I modified your code

Let ( [
    pos = Position ( Shop_cikkadatok::pic ; ";" ; 1 ; 1) ;
    rem = Length ( Shop_cikkadatok::pic ) - pos ;
    thePart = Left ( Shop_cikkadatok::pic ; pos - 1 ) ;
    res = Left ( thePart ; 1 ) & "/" & Middle ( thePart ; 2 ; 1 ) & "/" & thePart & ".jpg;"
    ] ;
    res & Case ( rem ;  Middle ( Shop_cikkadatok::pic ; pos + 1 ; rem ) )
  )

If the original data example this "Logo_MAXIM;DIP16;DIP16_Z;" the result will this: "L/o/Logo_MAXIM.jpg;DIP16;DIP16_Z;"

This better than my code but I would like to modify second and third part too: "/L/o/Logo_MAXIM.jpg;/D/I/DIP16;/D/I/DIP16_Z;"

Link to comment
Share on other sites

I modified your code

 

This doesn't work; you need a recursive function.

 

Use my code to create a Custom Function (CF) named “Customize”, with parameter “string”, then call it as 

Customize ( Shop_cikkadatok::pic )

Actually, you can call the CF whatever you want, but be aware that if you give it another name than “Customize”, you need to change the function call in the code itself (that's the “recursive” part) from “Customize” to the new name.

 

 

PS: If you use Let(), why not do it thoroughly?

Let ( [
    ~s = Shop_cikkadatok::pic ;
    pos = Position ( ~s ; ";" ; 1 ; 1) ;
    rem = Length ( ~s ) - pos ;
    thePart = Left ( ~s ; pos - 1 ) ;
    // etc... 
Link to comment
Share on other sites

This topic is 2921 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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