AaronJ
|
| Posted: 08/02/2002, 7:34 PM |
|
Will someone please point me in the right direction here. PHP generated
code, I would just like to change the values in a field.
How do I access the output variable and modify.
I tried placing this code in the forms event BEFORE_SHOW_ROW and in fields
before_show...
The label is called 'placement' and here's how I want to replace:
Switch ($placement) {
case 0:
$placement = "Do Not Display";
break;
case 1:
$placement = "Top";
break;
case 2:
$placement = "Left";
break;
case 3:
$placement = "Right";
break;
case 4:
$placement = "Bottom";
break;
default:
$placement = "No Setting";
}
-Aaron
|
|
|
 |
AaronJ
|
| Posted: 08/02/2002, 8:12 PM |
|
God, a little documentation would be nice!
Switch ($images->placement->GetValue()) {
case 0:
$images->placement->SetValue("Do Not Display");
break;
"AaronJ" <aaronjudd@coolersites.com> wrote in message
news:aifffs$c1a$1@news.codecharge.com...
> Will someone please point me in the right direction here. PHP generated
> code, I would just like to change the values in a field.
> How do I access the output variable and modify.
>
> I tried placing this code in the forms event BEFORE_SHOW_ROW and in fields
> before_show...
>
> The label is called 'placement' and here's how I want to replace:
>
> Switch ($placement) {
> case 0:
> $placement = "Do Not Display";
> break;
> case 1:
> $placement = "Top";
> break;
> case 2:
> $placement = "Left";
> break;
> case 3:
> $placement = "Right";
> break;
> case 4:
> $placement = "Bottom";
> break;
> default:
> $placement = "No Setting";
> }
>
> -Aaron
>
>
|
|
|
 |
DonB
|
| Posted: 08/03/2002, 6:43 AM |
|
Aaron,
Please, calm down. You'll probably get more people willing to help.
I'm an ASP developer, not a PHP developer - never read or wrote one line of
PHP code and just 5 minutes ago installed PHP to give this a look. So let's
begin (bear wth me if you've been through this exercise already):
First, I went to the Property page after selecting the label I placed on my
form. On Properties/Events, I chose "Server Before Show and then
right-clicked to add the event "Retrieve value for control".
Next, I filled in the three values there for Control Name (I selected
"Label1"), SourceType (I selected "Expression"), and Source Name (I entered
the exact string to fill the label with, enclosed in quotes).
While simplified, this demonstrates what you are trying to do, I think. I
find the way to learn how to do more complex tasks are best started with
creating something simple like this, then looking at what CCS puts into the
event code file. Then I usually can figure out how to do the fancier stuff.
Maybe you've done this and have not had success. But, I hope that this
gives you someplace to start working out your difficulties.
My sense is that you may be "swimming against the current", and are
attempting to apply your prior PHP experience and coding style to CCS rather
than "going with the flow". Using a code-generator means having to learn
how they do things and possibly change your own style to make your work
easier.
But I wholeheartedly agree with your frustration with the documentation.
That always seems to be given too little attention. And that is not a jab
at Yes, but at the software business as a whole.
don
"AaronJ" <aaronjudd@coolersites.com> wrote in message
news:aifhne$fqb$1@news.codecharge.com...
> God, a little documentation would be nice!
>
>
> Switch ($images->placement->GetValue()) {
> case 0:
> $images->placement->SetValue("Do Not Display");
> break;
>
>
>
>
> "AaronJ" <aaronjudd@coolersites.com> wrote in message
>news:aifffs$c1a$1@news.codecharge.com...
> > Will someone please point me in the right direction here. PHP generated
> > code, I would just like to change the values in a field.
> > How do I access the output variable and modify.
> >
> > I tried placing this code in the forms event BEFORE_SHOW_ROW and in
fields
> > before_show...
> >
> > The label is called 'placement' and here's how I want to replace:
> >
> > Switch ($placement) {
> > case 0:
> > $placement = "Do Not Display";
> > break;
> > case 1:
> > $placement = "Top";
> > break;
> > case 2:
> > $placement = "Left";
> > break;
> > case 3:
> > $placement = "Right";
> > break;
> > case 4:
> > $placement = "Bottom";
> > break;
> > default:
> > $placement = "No Setting";
> > }
> >
> > -Aaron
> >
> >
>
>
|
|
|
 |
AaronJ
|
| Posted: 08/04/2002, 5:13 PM |
|
Don,
Excellent!
My previous post (second post) was my inadequate way of saying that I solved
the problem. However, I agree with as this is an IDE I should have this kind
of functionality available, and I shouldn't have to hand code. BTW- Although
I do hand-code of lot of PHP (and other languages as well), I have used CC
for over a year and so am familiar with the CC way of doing things. Since
the application I use CC for is quite complex I have become very familiar
with the under the cover coding style of CC. With CCS, things are different,
and far superior in that the Yes team has taken a far superior object
styling to the code, and I am not complaining (even if I may sound
hysterical).
OK - So about your solution.
It may work, but the single line 'Source Name' didn't really give me a clue,
when really what I want is a lookup field. I am not sure I can really think
of an instance where I would always want a label to be replaced with a
static value that never changed. Seems rather kludge when I could just use
HTML.. ?
What I am doing is replacing a '0' in the database with a 'human' legible
label.
I did try to see if there was further documentation on how this action might
be used, but it seemingly was left out of the manuals,etc.
BTW - if you are familiar with CC .. what I am doing is three clicks there.
FIELD>LIST>List of Values - and this functionality has been included for
List Boxes in CCS (records), but seemingly left out for labels.
So my solution in more detail is:
In Form Properties> Events>Before Show Row>Custom Code:
function images_BeforeShowRow() { //images_BeforeShowRow @2-4AA9C7BB
//Custom Code @75-2A29BDB7
// -------------------------
global $images;
Switch ($images->placement->GetValue()) {
case 0:
$images->placement->SetValue("All Views");
break;
case 1:
$images->placement->SetValue("Content List View");
break;
case 2:
$images->placement->SetValue("Content Detail View");
break;
default:
$images->placement->SetValue("No Setting");
}
}
// -------------------------
//End Custom Code
Since you are an ASP guy.. i'll break it down. I saw several examples in the
newsgroups and elsewhere that referenced something similiar being done in
ASP. Difference is the way the ASP object model is referenced, that's all.
so.. in asp that would be formname.field.method(param); instead of my
above PHP ( $formname->field->method(param); )
I, of course, had to glean the methods from the rather hard to locate
programmer's reference at:
http://www.codecharge.com/studio/reference/1_0_6/
BTW - perhaps a better way but it just seems like overkill here; is to
create a table with the entries to display, and just use SQL for the
join/view with the correct labels.
Thanks for your help though, and I am looking forward someone correcting, or
confirming my approach It seems like a lot of work for an IDE....
|
|
|
 |
DonB
|
| Posted: 08/04/2002, 8:25 PM |
|
If all you are needing is to display text in lieu of a numeric code, why not
base the datasource on a view and provide the appropriate text directly from
the database? This has the benefit of keeping data dependencies out of
your app code and so if other values are required later, you just change the
data in the database.
Since a view like this will typically not be "updateable" (because there are
multiple tables involved), I rely on the custom insert and update properties
of the form, to directly act on the correct table. This is both easy and
straightforward to do.
I think the reason that LOV is not a property of textboxes, is that it is
not really necessary, while it is for listboxes. A listbox is a
data-conversion mechanism to allow us to input coded values by using
friendly names (i.e., LOV), while labels are just used to output meaningful
information to us. So the simpler approach is to just put the friendly name
directly into the datasource that loads the label field. Obviously, if you
need the code value for something, you can include it as well.
don
|
|
|
 |
|