Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Creating HUD Widgets    Accessing a Form's definition name through a HUD?
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Pro
Picture of Andy Warwick
Posted
I've got the following code for a HUD to loop through all the Forms attached to an Organization and echo out each Form's name.

What I'm after now is the syntax to test against the Form definition’s name so I can limit the output to a particular type of Form.

Specifically, I have a Form type called 'FTP Server Details', and I'd like a way to limit the loop so that only that type of Form is queried.

The ultimate plan is to create links to login to the Org's FTP servers via an 'FTP' Url.

Each 'FTP Server Details' Form has a name (e.g. 'Intranet FTP Server') and three fields: 'Server Address', 'Username' and 'Password'.

By looping through all the Forms on an Org, limiting the result-set to 'FTP Server Details' Forms, then querying the fields on each of those, I hope to end up with a list of links of the form '<a href="ftp://Username:Password@Server Address>Server Name</a>' which I can directly click and thus login to the FTP server.

I believe it's something to do with the CustomRecordSetDefinition object, but I can't seem to hit the right syntax.

Thoughts?

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" type="text/css" href="dl_business.css" />
  </head>
<body>
  <table cellspacing="0" cellpadding="0" border="0" class="dl_business_content">
    <tr><td>
      <!-- Loop over every Form the record has -->
      <$foreach form model.customRecordSets do$>
        <table id="dl_business_appointment_header" class="dl_business_table" cellspacing="0" cellpadding="0" border="0">
          <tr><td>
            <span class="dl_business_normal"><strong><$form.name$></strong></span>
          </td></tr>
        </table>
      <$endforeach do$>				
    </tr></td>
  </table>
</body>
</html>			


--
Andy Warwick
www.creed.co.uk
 
Posts: 216 | Location: Nottingham, UK | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
Marketcircle Team
Picture of Michael Clark
Posted Hide Post
Hi Andy.

Is the form name not what you are looking for?

I am a bit confused.

Michael.
 
Posts: 88 | Location: Markham, Ontario | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
Pro
Picture of Andy Warwick
Posted Hide Post
Hi Michael

I'm after both the Form’s Name, and the 'Name' of the Form's Type.

Each Org can have multiple copies of this same Form, thus:

FTP Server Details: Name ('Website'), Server Address ('www.example.com'), Username, Password
FTP Server Details: Name ('CRM Server'), Server Address ('192.168.0.10'), Username, Password
FTP Server Details: Name ('Intranet Server'), Server Address ('192.168.0.20'), Username, Password

And so on.

So I need to loop through all the Forms on the Org, and then—for each Form that is of type 'FTP Server Details'—echo out the Name and create the link to the server from the Form's Fields.

I need to access the Form's Definition's Name (which appears in the Daylite preferences as Form Type and as the blue header text in the Form’s Detail View), so I don't try and get Username field, etc. from different types of Form that may also be attached to that same Org.

See what I mean?

I could also do with some help with the syntax for accessing a specific Form Field's content: for example, what's the reference to get the contents of Form Field entitled 'Server Address'?


--
Andy Warwick
www.creed.co.uk
 
Posts: 216 | Location: Nottingham, UK | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
Marketcircle Team
Picture of Michael Clark
Posted Hide Post
Yes, I get you now! smile

Okay, try this merge key:
<$form.customRecordSetDefinition.name$>

In our data model (the description of how all our data hangs together!), a form is called CustomRecordSet, hence the customRecordSetDefinition key, which takes you to a CustomRecordSetDefinition which, well, defines what is in the CustomRecordSet.

So, CustomRecordSet is analogous to Form (What you create on an object)
and, CustomRecordSetDefinition is analogous to say Form Definition (What you create in the preferences).

I hope this helps.

Are you also looking for info on how to do the if tag, or do you have that one convered?
(I would have to look that up, hence I am asking!) wink

Michael.
 
Posts: 88 | Location: Markham, Ontario | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
Pro
Picture of Andy Warwick
Posted Hide Post
Thanks Michael

I think I have the ‘if’ tag covered, but if I get into any more difficulties I’ll let you know.

Cheers


--
Andy Warwick
www.creed.co.uk
 
Posts: 216 | Location: Nottingham, UK | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
Marketcircle Team
Picture of Michael Clark
Posted Hide Post
Oh, I missed one of your questions first time around...

This is taken from your example you posted. For clarity here I removed all the style stuff as to not complicate the code.

<$foreach form model.customRecordSets do$>
  <$if form.customRecordSetDefinition.name == "FTP Server Details"$>
    <table>
      <tr>
        <td>
          Name: <$form.Name$> <br>
          Server Address: <$"form.Server Address"$> <br>
          Username: <$form.Username$> <br>
          Password: <$form.Password$>
        </td>
      </tr>
    </table>
  <$endif$>
<$endforeach do$>	


I haven't tested this code, but it should work. Let me know if it doesn't.

But it should give you the basic idea. We wrap the table in an if tag, making sure that the CustomRecordSetDefintion's name is "FTP Server Details".
If it is then we will output a table with the Form name, server address, username and password.

Note the use of the " in the if statement, and the key for the Server Address. Anywhere that you have space in these tags you must wrap the key with the double quotes.

Hope that helps!
Michael.
 
Posts: 88 | Location: Markham, Ontario | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
Pro
Picture of Andy Warwick
Posted Hide Post
Michael

That doesn't seem to work.

Using

Server Address: <$"form.Server Address"$>


Outputs:

Server Address: "form.Server Address"


direct into the HUD

And using any of the other Fields, like Username, without quotes:

Username: <$form.Username$>


Causes a crash.

Any suggestions?


--
Andy Warwick
www.creed.co.uk
 
Posts: 216 | Location: Nottingham, UK | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
Marketcircle Team
Picture of Michael Clark
Posted Hide Post
Hmm... I will have to look into that.

I will get back to you later, I will need to play with it.

Michael.
 
Posts: 88 | Location: Markham, Ontario | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
Pro
Picture of Scott McCulloch
Posted Hide Post
I just tried this with my HUD and was having the same problem. So I looked at an old DL1.x report template and got an idea...

try this:
Username: <$form.dictionaryRepresentation.Username$>  


It looks like it worked in my case.

Scott
 
Posts: 160 | Location: San Jose, CA | Registered: June 14, 2006Reply With QuoteEdit or Delete MessageReport This Post
Pro
Picture of Andy Warwick
Posted Hide Post
Scott

Brilliant!

That looks like it got it; and it doesn't seem to need the quotes as Michael suggested either.

<$form.dictionaryRepresentation.Server Address$>


Pulled exactly the expected information.

Just have to polish the final details now, and it'll be ready to release to the forum.

Cheers


--
Andy Warwick
www.creed.co.uk
 
Posts: 216 | Location: Nottingham, UK | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
AJ
Marketcircle Team
Picture of AJ
Posted Hide Post
You may want to avoid calling dictionaryRepresentation all the time. It is a costly operation. Call it once and use the dictionary thereafter. Use the 'identify' or 'set' command.

<$identify myForm = form.dictionaryRepresentation$>

After that, myForm will be the dictionaryRepresentation.

<$myForm.Server Address$>
 
Posts: 890 | Location: Toronto | Registered: May 03, 2006Reply With QuoteEdit or Delete MessageReport This Post
Pro
Picture of Andy Warwick
Posted Hide Post
Hi AJ

Thanks for the heads up.

I'm still a little confused between the different ways of extending Daylite; where do I find the syntax for the different commands we can use in a HUD, such as 'identify' and 'set'. Are these f-script in origin?

Cheers


--
Andy Warwick
www.creed.co.uk
 
Posts: 216 | Location: Nottingham, UK | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
Marketcircle Team
Picture of Ali Lalani
Posted Hide Post
These are part of the MiscMergeKit engine that we use.

The documentation for this is available in the Developer Kit, "Daylite 3 Public Developer Kit.pdf" page 28.

F-Script is a different beast, and currently there is no way to use it from a HUD Widget.
 
Posts: 108 | Registered: June 15, 2006Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Creating HUD Widgets    Accessing a Form's definition name through a HUD?

© Copyright 2006 Marketcircle Inc. All rights reserved.