Topic
  • 2 replies
  • Latest Post - ‏2012-12-07T18:47:03Z by SystemAdmin
SystemAdmin
SystemAdmin
757 Posts

Pinned topic Help with concatenation using Relevance

‏2012-12-07T16:43:10Z |
Here is some relevance code I have that is working in the fixlet debugger.

Q: (parent folder of it, name of it, size of it, (((if (length of it =1) then ("0"&it) else it) of (month of it as integer as string) & "/" & (if (length of it =1) then ("0"&it) else it) of (day_of_month of it as string) & "/" & (year of it as string)) of date ("pdt" as time zone) of it & " " & ((if (length of it =1) then ("0"&it) else it) of (hour_of_day of it as string) & ":" & (if (length of it =1) then ("0"&it) else it) of (minute_of_hour of it as string)& ":" & (if (length of it =1) then ("0"&it) else it) of (second_of_minute of it as string)) of time ("pdt" as time zone) of it) of creation time of it, (((if (length of it =1) then ("0"&it) else it) of (month of it as integer as string) & "/" & (if (length of it =1) then ("0"&it) else it) of (day_of_month of it as string) & "/" & (year of it as string)) of date ("pdt" as time zone) of it & " " & ((if (length of it =1) then ("0"&it) else it) of (hour_of_day of it as string) & ":" & (if (length of it =1) then ("0"&it) else it) of (minute_of_hour of it as string) & ":" & (if (length of it =1) then ("0"&it) else it) of (second_of_minute of it as string)) of time ("pdt" as time zone) of it) of modification time of it, (((if (length of it =1) then ("0"&it) else it) of (month of it as integer as string) & "/" & (if (length of it =1) then ("0"&it) else it) of (day_of_month of it as string) & "/" & (year of it as string)) of date ("pdt" as time zone) of it & " " & ((if (length of it =1) then ("0"&it) else it) of (hour_of_day of it as string) & ":" & (if (length of it =1) then ("0"&it) else it) of (minute_of_hour of it as string) & ":" & (if (length of it =1) then ("0"&it) else it) of (second_of_minute of it as string)) of time ("pdt" as time zone) of it) of accessed time of it) of find files "*.db" of (it; descendant folders of it) of folder "C:\nmdata"

A: C:\nmdata, ( blah-doe,john.db ), 24, 11/26/2012 10:15:16, 11/26/2012 13:56:57, 11/26/2012 10:15:16

As you can see the majority of the code is to modify the date-time format. The problem I am running into is that I want to change the output items to be separated by a "|" instead of a comma. The reason is because some of the folders returned have commas in the name, causing the the comma separated values to parse incorrectly in Excel, scripts, etc. I've tried numerous way of concatenation, like adding 'concatenation "|" of' to the front of the code. I've also tried replacing the commas in the code separating the elements manually with & "|" &. This is not working for me either. I'm sure there is an issue with the context, but I'm stumped as to how to code this.
  • SystemAdmin
    SystemAdmin
    757 Posts

    Re: Help with concatenation using Relevance

    ‏2012-12-07T17:11:09Z  
    I would start by first converting everything to a string so that you can concatenate it with other strings such as "|"

    Before
    q: (parent folder of it, name of it, size of it, (((if (length of it =1) then ("0"&it) else it) of (month of it as integer as string) & "/" & (if (length of it =1) then ("0"&it) else it) of (day_of_month of it as string) & "/" & (year of it as string)) of date ("pdt" as time zone) of it & " " & ((if........
    A: C:\test, some.db, 30, 12/07/2012 10:00:33, 12/07/2012 09:59:56, 12/07/2012 10:00:33
    T: 1.063 ms
    I: plural ( folder, string, integer, string, string, string )
    After:
    q: (parent folder of it as string, name of it, size of it as string, (((if (length of it =1) then ("0"&it) else it) of (month of it as integer as string) & "/" & (if (length of it =1) then ("0"&it) else it) of (day_of_month ........
    A: C:\test, some.db, 30, 12/07/2012 10:00:33, 12/07/2012 09:59:56, 12/07/2012 10:00:33
    T: 1.071 ms
    I: plural ( string, string, string, string, string, string )
    Then you can concatenate however you like using item 0, item 1, etc...

    (item 0 of it & "|" & item 1 of it & "|" & item 2 of it & "|" & item 3 of it & "|" & item 4 of it & "|" & item 5 of it & "|" & item 5 of it) of (parent folder of it as string, name of it, size of it as string, (((if (length of it =1) then ("0"&it) else it) of (month of it as integer .......
    A: C:\test|some.db|30|12/07/2012 10:00:33|12/07/2012 09:59:56|12/07/2012 10:00:33|12/07/2012 10:00:33
    T: 1.212 ms
    I: plural string
  • SystemAdmin
    SystemAdmin
    757 Posts

    Re: Help with concatenation using Relevance

    ‏2012-12-07T18:47:03Z  
    I would start by first converting everything to a string so that you can concatenate it with other strings such as "|"

    Before
    q: (parent folder of it, name of it, size of it, (((if (length of it =1) then ("0"&it) else it) of (month of it as integer as string) & "/" & (if (length of it =1) then ("0"&it) else it) of (day_of_month of it as string) & "/" & (year of it as string)) of date ("pdt" as time zone) of it & " " & ((if........
    A: C:\test, some.db, 30, 12/07/2012 10:00:33, 12/07/2012 09:59:56, 12/07/2012 10:00:33
    T: 1.063 ms
    I: plural ( folder, string, integer, string, string, string )
    After:
    q: (parent folder of it as string, name of it, size of it as string, (((if (length of it =1) then ("0"&it) else it) of (month of it as integer as string) & "/" & (if (length of it =1) then ("0"&it) else it) of (day_of_month ........
    A: C:\test, some.db, 30, 12/07/2012 10:00:33, 12/07/2012 09:59:56, 12/07/2012 10:00:33
    T: 1.071 ms
    I: plural ( string, string, string, string, string, string )
    Then you can concatenate however you like using item 0, item 1, etc...

    (item 0 of it & "|" & item 1 of it & "|" & item 2 of it & "|" & item 3 of it & "|" & item 4 of it & "|" & item 5 of it & "|" & item 5 of it) of (parent folder of it as string, name of it, size of it as string, (((if (length of it =1) then ("0"&it) else it) of (month of it as integer .......
    A: C:\test|some.db|30|12/07/2012 10:00:33|12/07/2012 09:59:56|12/07/2012 10:00:33|12/07/2012 10:00:33
    T: 1.212 ms
    I: plural string
    Yes sir! That solved it! Thank you for adding to my fledgling knowledge of Relevance! I can't thank you enough!