Jump to content

Split Vars to Args is confusing me


Recommended Posts

Hey everybody,

 

Im trying to split a {query} that contains two items into distinct variables with the "split vars to args" block. Somehow, the block does not split the variable though. Here is the debugger output:

 

[13:57:43.946] Script Filter - Getting Started[Script Filter] Processing complete
[13:57:43.954] Script Filter - Getting Started[Script Filter] Passing output '(
    "Offensichtlichen Effekt",
    abcdefg
)' to Split Arg to Vars
[13:57:43.956] Script Filter - Getting Started[Split Arg to Vars] Processing complete
[13:57:43.958] Script Filter - Getting Started[Split Arg to Vars] Passing output '(
    "Offensichtlichen Effekt",
    abcdefg
)' to Post Notification

 

The corresponding JSON entry is:

 

    {
        "uid": "33 25 2022 1 33",
        "type": "Link",
        "title": "Offensichtlichen Effekt",
        "subtitle": "[9783110526653 - Optik] Optik.pdf (page 898 of 1384)",
        "arg": ["Offensichtlichen Effekt","abcdefg"],
    },

 

Somehow the quotation marks for the second element are dropped. Not sure why that is. Anybody have a clue what I'm doing wrong?

 

Link to comment
37 minutes ago, Gearbox Sorrows said:

Somehow the quotation marks for the second element are dropped. Not sure why that is.


They aren’t dropped; they aren’t there to begin with. The other shows it because there is a space and it makes clear it’s a single entry. That isn’t relevant, thought.

 

39 minutes ago, Gearbox Sorrows said:

Anybody have a clue what I'm doing wrong?


We can’t say for sure unless you share (a simplified version of) your Workflow, and ideally explain what you’re trying to accomplish. Debugging is already hard with access to code, and you’re asking us to do it from an incomplete description. We don’t even know what’s the character you’re splitting on. Are you trying to split on commas? Because there are no commas in your output. And you’re sending two arguments, not one.

 

Why are you using the splitting utility? If you’re outputting from a Script Filter anyway, define the variables there. Or use the arguments directly.

 

Again, it’s impossible to say the best course of action (but it’s likely not splitting the argument) without context.

Link to comment
58 minutes ago, Gearbox Sorrows said:

I hope that makes it a little bit clearer.

 

It does!

 

59 minutes ago, Gearbox Sorrows said:

I've not yet tried defining the elements as their own variables. Didn't know that was possible too.

 

See Script Filter JSON Format and search for variables. You make them at the top level or per item.

 

1 hour ago, Gearbox Sorrows said:

I'm still interested though what I'm doing wrong with the splitting.

 

It’s what I deduced above:

 

2 hours ago, vitor said:

Are you trying to split on commas? Because there are no commas in your output. And you’re sending two arguments, not one.

 

"arg": ["Offensichtlichen Effekt","abcdefg"] means there are two arguments: the first is Offensichtlichen Effekt and the second abcdefg. None of them has a comma in it, so there is no splitting. Try instead "arg": "Offensichtlichen Effekt,abcdefg" (one argument, with a comma) or add a comma anywhere inside the quotes for one of the arguments and it will work.

Link to comment

Ahh, now I understand. I thought I have to pass a List of argument strings instead of one string that's to be split. Thank you a lot! I also got it working with the variables, which fits a bit better for my workflow, but nonetheless, it's good to know how it works now. 

Link to comment
On 1/25/2022 at 6:56 PM, Gearbox Sorrows said:

I thought I have to pass a List of argument strings instead of one string that's to be split.

 

You can pass a list of strings. They will either arrive as multiple arguments (in ARGV) or as a single tab-delimited string.

 

Link to comment
8 hours ago, deanishe said:

You can pass a list of strings. They will either arrive as multiple arguments (in ARGV) or as a single tab-delimited string.

very nice! so if you have downstream an object that takes {query} as an input (e.g. Large Type), you need to interpose a 'Split Arg to Vars' utility to access the individual elements? Or, is there a way to access the elements of the list (like, say, {var:query1})?

Link to comment

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
×
×
  • Create New...