Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Labels Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Lenny
Senior Member
Senior Member


Joined: January 06 2008
Online Status: Offline
Posts: 102
Posted: February 20 2015 at 16:31 | IP Logged Quote Lenny

Is there a way to remove an old unused label from
powerhome? If it's in the GUI I must be missing it. I'm
sure it's a record in a table but if I can remove it
through the interface that's preferred.

Also it would be nice to know how to associate things
with a label with SQL. If I export a macro for example
in in SQL make my changes and import it I loose the
labels associated. I'd like to know how to maintain
that.
Thanks
Back to Top View Lenny's Profile Search for other posts by Lenny
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: February 20 2015 at 22:06 | IP Logged Quote dhoward

Lenny,

I need to do some more work to the labeling system.
Currently no way to delete a label from the GUI
(Although you can remove a label from a particular
labeled item).

However, it can all be done through SQL. The labels
are controlled by two tables, labelheader and
labeldetail. To completely remove a label you would
use these two SQL statements:

delete from labeldetail where labelid = 'LABELID'
delete from labelheader where id = 'LABELID'

Adding labels can also be done with the following SQL
statements. To just create a label so its available to
assign use this:

insert into labelheader values ('LABELID','Label
Description')

To assign an existing label to use the following SQL:

insert into labeldetail values
('ITEMID',1003,'LABELID')

The first parm is the ID of what you're assigning a
label to. The second parm is the item type. For
macros, this is 1003. For global vars, this is 1000.
For formulas, this is 1010. Easiest way to determine
the number is to assign a label and then select it to
see the type number assigned. The third parm is the
label ID. To view these tables you can use these
statements:

select * from labelheader
select * from labeldetail

Hope this helps,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
Lenny
Senior Member
Senior Member


Joined: January 06 2008
Online Status: Offline
Posts: 102
Posted: February 20 2015 at 22:14 | IP Logged Quote Lenny

Thanks for the background Dave and for the prompt reply.
Back to Top View Lenny's Profile Search for other posts by Lenny
 
gg102
Senior Member
Senior Member


Joined: January 29 2013
Location: United States
Online Status: Offline
Posts: 245
Posted: February 20 2015 at 23:59 | IP Logged Quote gg102

This brings up something. I like using labels, but here in PH they can be clumsy. Let me show you some psuedo code:

Start_Label:
    function(...)
    function(...)
    goto_label if(something, True_Label, False_Label )
False_Label:
    function(...)
    end macro
True_Label:
    function(...)
    function(...)
    end macro

In PH, you're required to have a "True_Label" and a "False_label". In most cases, if "false", you would want fall
through to the next step in your macro and only want to take a jump if "True". The issue is that
for every conditional, you need two labels. This makes for a lot of unnecessary "False" labels (just to get to
the next step) when you're pretty much only wanting to take "True" Jumps. Also, you have to make unique "False" labels.
This is bulky.


What might be nice would be to add a new "GoToLabel" jump:
It would be "Go_To_Label_If_True_otherwise_fall_through_to_next".

Using this would eliminate all the unnecessary Labels for unwanted ( fall through) jumps.

ie:
Go_To_Label_If_True if(something, True_Label) (This implies, else next)

Another, simpler, possibility would be to make the "else" label optional, and if missing, default to "Next".


Currently, because of needing two labels, I have been using "Jump" which allows:
Jump if(something, X,1).....Jump x steps, otherwise next.

(BTW, don't know if you know this, but you CAN jump backwards!!!)
Jump if(something, 1,-x).....Jump 1 step, otherwise jump backwards x steps.
(Warning: This can make your brain hurt!)


This makes code changes very difficult because you have to re-count all jumps if you make any changes.
This is very tedious. Using Labels is better.

Back to Top View gg102's Profile Search for other posts by gg102
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: February 21 2015 at 00:16 | IP Logged Quote dhoward

gg,

You should be already good to go. If you goto a label
that doesnt exist, then it will just fall to the next
line. I use this alot in my code:

10 Goto Label if(something,"LABEL1","")
20
30
40 LABEL LABEL1

In line 10 if the something is false, it goes to an
empty label which will be the next line. Ive also seen
people use something like "nextline" for the false
above and nextline doesnt actually exist as a label.

Hope this helps,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
Lenny
Senior Member
Senior Member


Joined: January 06 2008
Online Status: Offline
Posts: 102
Posted: February 21 2015 at 08:29 | IP Logged Quote Lenny

Dave,
The SQL worked as expected however the interface didn't
refresh until I exited restart power home. I ran a
select statement to verify it was gone from the tables
but it still showed up in the interface. I'm assuming
the pick list is read and cached at some point.
Thanks again.
Lenny

Edited by Lenny - February 21 2015 at 08:30
Back to Top View Lenny's Profile Search for other posts by Lenny
 
gg102
Senior Member
Senior Member


Joined: January 29 2013
Location: United States
Online Status: Offline
Posts: 245
Posted: February 21 2015 at 09:19 | IP Logged Quote gg102

Dave,

That helps! It's amazing, you learn something new every day!

Thank you.
Back to Top View gg102's Profile Search for other posts by gg102
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: February 21 2015 at 10:48 | IP Logged Quote dhoward

Lenny,

You should only need to close and reopen the PowerHome
Explorer. The label data should be refreshed whenever
the Explorer is opened.

I'll run some tests to confirm though. Where are you
seeing the label data still appearing after deleting?

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum