Custom Part Context Menu Open With

Hang on a second. We were working on TransView.PartNum. That is what I set the binding for the text box to. Should I be using TransView.Parts instead? Im so confused…

Sorry, my instructions are an attempt to translate into your conversation but my screenshots may not match. My box is populating a TransView field called Parts. Yours is populating a field called PartNum. Eitherway, this is the Transview field you’ll use for your filter and trigger onChange to refresh.

Can you elaborate on those conditions? I see one is false and one is true. What are the expressions for each condition?

The first condition is not needed unless you want to pass multiple ValuesIn. I copied it from PartEntry AfterInit event and don’t even know how to pass such a thing. There’s some SetCompoundKeys event that I assume handles mulit-key. Whatever - you don’t need it.

I am struggling to get a working example still. Due to the bugs in App Studio I restarted the process several times, deleting everything I created and recreating it again. This is the process I have been following:

  1. Create a new App Studio Dashboard using the wizard.

  2. Add the BAQ and a grid view. Dont add controls or filters.

  3. Add a dataview called TransView. Dont make any changes, just save it.

  4. Add a textbox to the grid header, call it PartNum. Epbind it to TransView.PartNum.

  5. Set the grid BAQ Options like this:

  6. Edit the window_event, Event: window after. Add a condition:


    With the expression: context && context.initialValueIn && context.initialValueIn.ValueIn

  7. Add a row-update on the True branch:

  8. Add the event to refresh the form when editing the part number field.

  9. Save, Commit, Publish.

  10. Add menu item (process) for new App.

  11. Add context menu item for Part Entry form to point to new menu process item.

  12. Close everything and open Part Entry, look up a part number, right click it and try to open with KineticRunBefore.

  13. Notice that Kinetic sucks total butt, and your dashboard hasn’t been filtered by the part number you right clicked on.

I have tried various iterations on this process many times. I took your advice and tried to get just the dashboard with the part number text box filter working. I never got that to work, so I thought maybe it would work better if I was opening it from the right click menu every time. I think I am close to a solution here.

Nice work. Does the grid filter work when you type a valid PartNum in the box?

I suspect not because you need single quotes in your WHERE filter expression.

Try Where:

JobAsmbl_PartNum IN('?{TransView.PartNum}')

the reason yours is different than mine is because I’m filtering on many values using IN() so the delimited value conversion is handling the quotes.

Since your PartNum is only single value you could also do:

JobAsmbl_PartNum = '?{TransView.PartNum}'

Once you get the filter working on your dashboard then we’ll work though the ValueIn (if needed)

2 Likes

Yes!!! That did it! All I was missing was the dumb single quotes. Gah!!! Thank you so much for your patience! It all work perfectly now. I’ll write it up soon!
Excited Ric Flair GIF

2 Likes

So It works perfectly for some part numbers, but for others it pops a slideout error saying “Invalid or unexpected token.”

I can use the same part entry screen and with one part it works, another part it doesn’t work. When it pops that error I can see in the dev tools: I marked out in red my part number. It was listed right there. If I have the dashboard open already, then I can use the text box and pull that part number, but it doesn’t seem to work when I right click it. There are several parts that do and do not work. I can’t tell why some do and some do not.

Edit I am not running any functions as part of this. I don’t use that built in function you mentioned because I don’t have a list of parts.

It seems like part numbers that contain letters produce that error. :thinking:

Interesting when I passed part number that contained a dash, it truncated it at the dash so it only includes numbers. I am not sure why…

Does something in the expression strip characters?


Edit I have set my data type to string but it didnt help.

So when my part number has a dash, it acts like a subtract. So for part 9620-308, when I right click and open with my dashboard, I get part number 9312 instead! Any part that has a character wont load at all in my dash and just gives that error: Invalid or unexpected token. I think something must be converting my strings into ints. I can’t tell where this happens. Perhaps in the way I am assigning the value in my BAQ options: JobAsmbl_PartNum = ‘?{TransView.PartNum}’ Or in setting the PartNum to Value In: %session.context.initialValueIn.ValueIn%

I fixed my row-update widget to use this expression with double quotes around the whole thing:

"%session.context.initialValueIn.ValueIn%"

This worked!!

3 Likes

Nice job Nate. glad its working. yeah there are some bugs in the parser causing plus signs to concat and minus signs to subtract and number treated as text, etc.

FWIW, clicking on the top most link in your console error and putting a breakpoint in w.evaluate is how I usually figure out what the expression syntax eval is doing.

2 Likes

How to Add Right Click - Kinetic - Kinetic ERP - Epicor User Help Forum

2 Likes

Can you tell me more about what the condition: context && context.initialValueIn && context.initialValueIn.ValueIn does?
Is it like, context exists, initial value in exists, and the value is valid?

1 Like

Yeah. Exactly. so in javascript you’ll get an error trying to get the property of an object that doesn’t exist so common practice is to check for existence up the chain to property. The check will bail and return false instead of error upon first non-existence so it’s safer that way. The property you want is .ValueIn but let’s first make sure it’s parents are there.

3 Likes