Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hello People!

I was just wondering (Hopeing) to find a script that will allow or prevent a user from enetering data in to a Portal.

I would like to have a button trigger this script so that onClick it will set the portal to be "Editable" or better said Entry Will Be Allowed but if not clicked it will remain "locked" from data entry!

Is this evern possible?

Thank you all for taking your time!

Posted

Hi Alen,

Hmmm, you want anyone to be able to click the button to unlock the portal?

What you might consider is placing a transparent rectangle over the entire portal line (be sure to keep it within the boundaries of the portal row (particularly the left top). Attach your script to this transparent button. Then use conditions to decide whether to let the User enter the field - Status(CurrentRecordAccess) or whatever criteria required.

If the User or situation doesn't meet the criteria, you can Show Message telling the User why their entry is denied. smile.gif

LaRetta

Posted

Hi LaRetta!

Thank you for the post smile.gif

Actually, I was looking into series of script-steps on that "button" and one of them will be the "locking" part. and Yes every user will have the right to enter data.

What I really want is to prevent user from entering anything until the button is clicked which will then, also, create a new record in related file (don't ask why smile.gif ) opening the portal for entry. I am trying to "cheat" the relationship (two portals into one the same file) but I need the other (locked) portal to create "duplicate ID". Here is little txt graph:

----open portal-----------------------

[iTEM NAME]

.....

-----------------------------------

[:script BUTTON :] (copy entered ITEM NAME into LineItem.fp5 and Unlock the portal)

----LOCKED PORTAL--------------------

[some more fields]

[more info]

------------------------------------

I know that many people will jump on my post and start talking about the relationships...trust me that option is already used ( Ugo knows how much pain is invested here).

So, my last hope is this "script"

Thank you!

Posted

Hi Alen,

Thanks for the additional information. The transparent rectangle script can test whether (from your main script) you have set a global (num) field (for example). And if the global num hasn't been set, deny access.

Just include that within your main script. If a User tries to enter the portal and the global num is blank - deny access. I'm a bit tired and not sure I'm explaining it very well. Your main script has total control. Set a global. Have the portal script check the status. smirk.gif Just remember to reset the global (re-lock it) from within your main script when done.

LaRetta

Posted

Hi LaRetta!

before anything....this might sound stupid but...how do u make a transparent button? I have not seen that option for button patern/color combo nor did I ever needed "invisible buttons" before today smile.gif

thank you

Posted

Actually it would be a transparent rectangle. Select it from Status Area, second row first item. If you change fill pattern and pen pattern to far left/top option, it will make them transparent!

LaRetta

Posted

u guys are killing me with these 5 pages of a script smile.gif

one of these days I will learn to accept them as useful wink.gif

Posted

Sorry I don't get it. Why are you using copy/paste.

When the WS_ID is the key for your portal, then it will be entered automaticaly in the line item. Item_ID should be a lookup field using the same reverse relationship from Line Item to Main WS_ID::WS_ID.

Posted

sorry for the post...my mind was "looped" into my goal instead of finding a right mean to do it.

Posted

OK guys....here is what I would like (= Help ME ) to create:

the scenario:

=============portal================

[WorkerID] [Action]

----------------------------------

101 Paint, Sand

101 --empty--

101 --emptry--

205 Sand, Polish, Paint

205 --empty--

205 --empty--

205 --empty--

--------------------------

=======================================

the script:

I would like to lock the portal rows based on condition:

WHERE WorkerID is NOT OR IS empty AND Action IS Empty

do NOT allow entry/editing of the row!

Help Help Help

so far I have :

the transparent button over the portal row that calls(onclick) the script:

------------------------------------------------------------

Go to portal row [First]

Go to portal row [Next]

If [(not IsEmpty(ITEMS_LINEITEMS::Worker_ID) or IsEmpty(ITEMS_LINEITEMS::Worker_ID)) and (IsEmpty(ITEMS_LINEITEMS::Action))]

Show Message (' you can not edit this row, please scroll down for the new entry')

Else

Go to portal row [Next]

EndIf

-----------------------------------------------

but ovisoly this is not working.....can some one help!!!!

thank you all!

Posted

Hi LebiSol,

I think that you don't need all the 'goto portal row' steps, and you need to add a

goto field [iTEMS_LINEITEMS::FieldToEdit] when editing is allowed.

You script would become something like:

If [(not IsEmpty(ITEMS_LINEITEMS::Worker_ID) or IsEmpty(ITEMS_LINEITEMS::Worker_ID)) and (IsEmpty(ITEMS_LINEITEMS::Action))]

Show Message (' you can not edit this row, please scroll down for the new entry')

Else

goto field [iTEMS_LINEITEMS::FieldToEdit]

EndIf

Hope this helps,

Regards,

Ernst.

Posted

Hi Ernst!

Thank you, that did solve a lot of problems...but now the condition is making me wonder:

If [(not IsEmpty(ITEMS_LINEITEMS::Worker_ID) or IsEmpty(ITEMS_LINEITEMS::Worker_ID)) and (IsEmpty(ITEMS_LINEITEMS::Action))]

this works great for exsiting records but also does not allow addition of a new record in a row...hm....have I looped myself beyound repair?

Posted

Hi Leb,

>>have I looped myself beyound repair?

Well, that happens to everybody. Good for your character wink.gif

But seriously, I think you should take a second look at the IF statement. The first bit,

(not IsEmpty(ITEMS_LINEITEMS::Worker_ID) or IsEmpty(ITEMS_LINEITEMS::Worker_ID))

is like saying "if the light is on, or if the light is off" i.e. this is allways true.

Succes and regards,

Ernst.

Posted

Hi HI!

Yeah I know about the condition...but honestly that was the one "that made the most sense".

If I drop one "NOT" or "IS" then it wont work again!

so if I have an existing set of records:

====portal 1=================

[worker_ID] [Action]

-------------------------

101 Paint

101 --empty--

101 --empty--

--------------------------

==============================

so If I was to to "fix" the condition to :

(not IsEmpty(ITEMS_LINEITEMS::Worker_ID)) and (IsEmpty( ITEMS_LINEITEMS::Action))

this protects the exsiting records from being edited-- GREAT!

but now the problem is when I try to add a new recod that is going to have both fields populated the condition doesn't apply since:

- I have to 1st enter the Worker_ID in order to continue to populating the rest of the fileds.

-Ones I enter the Worker_ID the condition above kicks-in and I can not continue to add the rest of the info frown.gif

...God, sometimes I actually miss SQL based aps

than you ALL!

Posted

perhaps an image will help better.I have included attachement-screenshot:

but basically in portal_1 first record is OK but I would like to protect the ones below (2 in this case but could be 'many') and still be able to continue to add records in portal_1 that WILL have more than just worker_ID and Name populated.

....did I present the situtation correctly?

2portals.jpg

Posted

Hey Leb,

I don't have a clue about SQL, but I think this problem is really well solvable in Filemaker.

Maybe just add an extra field to lock / unlock editing.

Advantage is that you can simply toggle this field to the 'unlock' position if you want to correct a wrong ID or action.

Script would look like:

If [iTEMS_LINEITEMS::Locked) = 1 ]

Show Message (' you can not edit this row, please scroll down for the new entry')

Else

goto field [iTEMS_LINEITEMS::FieldToEdit]

EndIf

Regards,

Ernst.

Posted

Hi Ernst!

You are the flash-light at this muddy abyss created by the FM laugh.gif

I have used before ( but coudn't remember $^%#^#@) the lock option...and have integrated it into LineItem file...its all dandy laugh.gif

now the very last deal is

----------------------

....

Else

goto field [iTEMS_LINEITEMS::FieldToEdit]

----------------

I am a few fields to edit...HOW do I "continue" to edit the rest of the field in the row?

perhaps with: ?

-----

goto field [iTEMS_LINEITEMS::FieldToEdit_1]

Pause Script

goto filed [iTEMS_LINEITEMS::FieldToEdit_2]

Pause Script

-----

.....all this is crazy that it just migh work...all I need is a little push over the hill and I might just be able cruise all the way down to the coast...even wihtout any gass wink.gif

_many thanx_ (:<[

Posted

Hi Leb,

The way you propose in your previous post could fail if a user would click outside the portal and then in the portal again.

I think you should make a separate script for every field that you want to edit this way.

We don't have any hills here in Holland, so I have no experience with >>cruising all the way down to the coast wihtout any gass... It's all hard labour!

Regards,

Ernst.

Posted

Hi Ernst!

Thank you for responding smile.gif

sorry about the "hill situtation" smile.gif but I am sure Holland has many other things to offer wink.gif

"I think you should make a separate script for every field that you want to edit this way."

- would this be something like:

=============portal==============

[button] || [filed] [field] ||<--- transparent button for "protection" over the fields

==================================

Thank You again!

Posted

Hi Leb,

>>but I am sure Holland has many other things to offer ...

It certainly has....

But about the database,

I don't think you need a transparent button on top of each field, just attach your scripts directly. I.e. select a field in the portal, choose Format -> Button from the menu and attach the corresponding script.

Scripts would be all the same, except for the field that the script should go to when access is allowed.

Si ?

Ernst.

Posted

Thank you....UR D MAN!

after all the suggestions of creating more and more relationships and blah blah ...here come Ernst with a 3 lines worth of a script to solove the problem!

THANK YOU ALL....LaRetta and Ugo as well!!!

">>but I am sure Holland has many other things to offer ...

It certainly has....

--> it has good FM developers I KNOW that for sure!

smile.gif AND NOW.....drinks on me...all u can drink!

Posted

Hi Alen!

Glad you got your issue resolved - you've certainly earned it! "after all the suggestions of creating more and more relationships and blah blah" Well, yes ... bloatism is a frequent problem in design. smile.gif

All the best,

LaRetta

This topic is 7823 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
×
×
  • Create New...

Important Information

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