Jump to content

=SUBSTRING (Obtaining Fixture Modes)


Recommended Posts

Hi all,

 

I'm attempting to use =SUBSTRING, a function I've been waiting forever for to help me obtain the MODE of a fixture.

 

See the screenshot attached for more reference. Ideally I would like the mode data to the right of the string in Column B with the delimiter being the content in Column A.

 

Therefore I thought I could use something like;

=SUBSTRING(('Lighting Device'.'Fixture Mode'), ('Lighting Device'.'FixtureID'), 2)

 

Which I had presumed would give me the string '18ch mode Emissive' in Column C. However I end up with 's'. Even as a single cell with manual strings I seem to only get random characters.

 

Anyone have a little more light to shed on this?

 

Cheers,

 

J

Screen Shot 2019-09-19 at 10.28.45 am.png

Link to comment

So.. I got angry at VW. 

 

=SUBSTRING (to the best of my knowledge) doesn't apply for this case where there is mismatched upper/lowercase characters - which I can accept.

 

So then I decided to write a script - (with the help of my good friend Dan);

 

--------- Copy below this line into a script of your choosing with Python ------------

 

#!/usr/bin/env python3


def removeFixtureId(v):
    obj = v.WSScript_GetObject()
    
    fixtureId = v.GetRField(obj, 'Lighting Device', 'FixtureID')
    fixtureMode = v.GetRField(obj, 'Lighting Device', 'Fixture Mode')

    # Locate the starting position of the Fixture ID within the Fixture Mode
    fixtureIdPos = fixtureMode.lower().find(fixtureId.lower())

    # If the position is 0 or more then it is present (-1 = not present), so we
    # should remove the Fixture ID from the Fixture Mode
    if fixtureIdPos >= 0:

        # We want to take letters from the end of the Fixture ID onwards
        readFrom = fixtureIdPos + len(fixtureId)
        fixtureMode = fixtureMode[readFrom:]

        # Remove any spaces that might be left over from the left+right
        fixtureMode = fixtureMode.strip()
    
    # Return the processed Fixture Mode
    v.WSScript_SetResStr(fixtureMode)
    return fixtureMode

# Uncomment the following line to activate this script
removeFixtureId(vs)

 

----------------- Above this line only ----------------

 

Now's where things get interesting. (see attached)

 

It looks as though the coding in the Lighting Device is swapping to fields around 'Lighting Device'.'Fixture Mode' and 'Lighting Device'.'Old Fixture Mode'. Calling these independently as column headers we get this .lit result (Dan presumes a key matched pair of the overall fixtures list or similar).

 

I have to tap out and continue with some real work however I would like the Mode field of the lighting device to populate with the Substring of the real Fixture Mode oneway - as the Num Channels currently does.

 

Enjoy the read.

 

J

 

Screen Shot 2019-09-19 at 1.13.08 pm.png

Link to comment
  • 4 months later...

VW Substring function is using a single character as a delimiter. When you give it a delimiter of more characters it treats any of them as a delimiter.

 

So in your case "Pixelline 1044" makes and character of [P, I, e, l, n, 1, 0, 4, {space}] a delimiter.

 

e matches in James and the space after James matches with the space delimiter. so the second match is "s"

 

Substring is just a kind of funky function. I would much prefer to have the power to find the location of a substring and then figure out what to return (Loc and Copy in VectorScript) rather than trying to figure out delimiters.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...