In Codecharge Studio how do i get a select box with optgroup tag? - codecharge

I am trying to use a optgroup tag in CCS. But the default list box doesn't have an option for this. Can someone explain how to get the recordset in After Execute Event and do a custom select HTML using PHP and put in place of the existing select code?

As you found out, the optgroup is not handled in CCS, so you are left with some overriding to do - or do what I did, and decide that optgroup wasn't worth the hassle.
You can use the Listbox Before Show (instead of 'After Execute') method to override/set up the options and use some of the supplied examples as a guide.
Check the help file for the following sections:
'Dynamically Modify the "List Of Values" of a ListBox'
'Retrieve Multiple Field Values from a Database'
There are also some partial solutions on the codecharge forums for overriding the options (search for optgroup)
Alternatively, you could consider 2 dependent drop-downs - the 'parent' with the Groups, and the 'child' with the options.
Edit: Modify SQL for listbox
You can do some pretty complex SQL in the Listbox Properties 'Data Source' (use 'Data Source Type' of 'SQL' and enter your SQL in the Query builder) As long as you return at least one column, it will be shown in the 'Bound Column' and 'Text Column' properties of the Listbox.
I'm confused why you reference the 'Before Build' events - you don't need to alter the code there - just use the Properties of the controls. For most of the setup of forms and controls, data etc, it can be done though the Properties and Events, without the need for modifying the generated code (once edited, it won't be regenerated if you change something so then you have code not updating and getting out of sync with the 'design' view)

Related

How to customize email template in crm 2016 by code

I am using CRM 2016, and trying to customize email template by adding a dynamic data. I know that CRM allows to use only specific vanilla entities, but when I explorer an old code I found an option to use {0}, {1} etc' for injecting data from non vanilla entities (by code) - unfortunately that code cannot be tested...
Have someone heard or know about that way? is it possible? what to google for?
You can do this by manually typing similar marker what CRM is using. Note that this is not documented in SDK.
Dynamic Values For Custom Entities In Email Templates
In the template, where you want the value to appear, type within 2 brackets an exclamation point followed by the entity logical name. After the entity name, add a colon, and then the field logical name, ending it with a semi colon. If you’d like a default value if nothing was found, after the semi colon add the default value.
{!<entitylogicalname>: <fieldlogicalname>; <Default Text>}
More in part 2:
The Global Template Type is what you’d want to use for custom
entities, or any other entity not listed in the template type drop
down menu. And just to reiterate, regardless of the way you insert
values, whether you use the out of the box insert method or you
manually type it in, you can only insert values from one record.
Dynamic Values For Email Templates - Part 2
Dynamics' email templates are flawed. You either can't use custom entities or you have no translation. I use this workflow instead. It can do everything : https://github.com/rtebar/dynamics-custom-emails

Microsoft Access Where Condition doesn't works in a subform

I built a form called: "clientlist":
I put a macro with where condition on click:
="IDclient_logindata=" & [Maschere]![clientlist]![IDclient]
this means that when I click on an id client, access will open another form with the respective IDclient. For example if I click on IDclient 3:
it open another form called "client_logindata" filter to IDclient_logindata 3.
Then, I built a navigational form:
using clientlist as subform. But when I click a record, any record, it open every time the client_logindata form with IDclient_logindata form = 1, why it doesn' works in a subform?
Design View of "Navigation Form":
Solved in this way: ="IDclient_logindata=" & [IDclient]
When using a subform, references to controls need to be relative to the main form where the subform is treated as a child control.
Consider adjusting the conditional to the following structure. Do note this is the English version:
="IDclient_logindata=" & Forms!myMainForm!mySubform.Form!mySubformControl
Or specifically tailored to yours (be sure to get exact spelling of all objects):
="IDclient_logindata=" & Forms!NavigationForm!clientlist.Form!IDclient
The OP has found a working solution which is much simpler than what follows. However, I was still interested to see if we could get something on the original model to work, and I'd guess that for users attempting to achieve the same thing using VBA rather than embedded macro's the following may still be useful.
The issue with the code in the original question is that the relevant form isn't open at the 'top level' but as a subform.
Form "normal" subforms, you'd refer to the control on the subform like this:
Forms!navform!clientlist.form!IDclient
Where navform is the name of the outer form. Or in the generalised case, like this:
Forms!Mainform!Subform1.Form!ControlName
However, the "Navigation Form" Wizard, when dragging subforms onto the Add New tab in Layout view doesn't name the subforms nicely. So I had to code it this way:
Forms![Navigation Form]!NavigationSubform.Form!ControlName
To my surprise this code continued to work when I added further forms within the Navigation Forms tabs and had controls named the same as one in question. I guess NavigationSubform automatically points to the tab with the current focus.

Alter input of form before it is submitted

I'm creating a multilingual Drupal site and trying to implement a search function, that only displays results in the current language, that the user is viewing the site through.
Using Drupals own searchfunction at /search/node it is possible to select which language to search for through the "Advanced search" options, and it works perfectly. However, I dont want to expose these language selectboxes, I just want it to only search in the current language automatically.
What's the best option to do this?
I have one solution where I create a hook_form_alter function, that sets the #default_value in the language selectboxes to the current language, and then I hide the whole "advanced options" with in css. This doesnt seem very right though.
I think the most clean solution would be to hook into Drupals form-processing process and append ex "language:en" to the input text, but I cannot get this to work.
Does anyone know if it is possible via one of the Drupal form related alter functions, to get a hold of the input text and alter it before drupal does its final processing of it?
To answer your question specifically, while using 'hook_form_alter', you have a referenced variable called '$form_state'. This stores the values in the form, and any change there will be passed further.
Also,
I think setting a default value and hiding the field is a good solution as any, only, if you are hiding it you should do it server side, while altering the form. The same field you are setting the default value to. like this:
$fieldname['#type'] = 'hidden'.

How to use TableViewer in WindowBuilderPro?

I have to create a table in my wizard page and I want to create it using TableViewer. I'm using WindowBuilderPro for designing my wizard page. The TableViewer control is available in the palette of WindowBuilderPro but I'm not getting how to use it properly.
Has any body used the same?
Thanks a lot in advance!!
You have two ways of filling the TableViewer with contents (similar to TableViewers in JFace):
You can define a content provider and a label provider manually. A content provider has to return a set of Objects, that represent each line of the table; while the TableLabelProvider translates the returned objects to texts in the columns. The content and label providers are to set in the Properties box on the left. In this case, the resulting code should look like the following snippets: http://wiki.eclipse.org/JFaceSnippets#Snippet001TableViewer or http://wiki.eclipse.org/JFaceSnippets#Snippet007FullSelection.
On the other hand you could define JFace Data Bindings to fill the table with contents. In this case you have to define a corresponding binding, that returns the list of all contents; additionally you have to create a label provider, that works similar to the previous one.
There is also a way to fill the table content using a newer API then supported directly by WindowBuilder: you could create TableViewerColumns, and ColumnLabelProviders for each column, thus resulting in much nicer code for Label Providers (and also this API is newer, so it should be preferred for new JFace based code) - but in this case you have to create your code manually. See the JFace Table tutorial from Lars Vogel.
Additionally, if you don't know the JFace Viewer framework from before, I suggest reading the first few questions listed in the JFace FAQ to gain a better understanding of the ideas (and the tutorial from Lars Vogel is also nice for this reason).

Make a radio button in an infopath form "read only"?

I'm making an InfoPath form which is tied to an Access database. I have a set of radio buttons where the user selects the software name corresponding to the form, but I store this in my database as a number (1, 2, or 3). In another view, I want them to be able to see the previously entered software name, but not be able to change this. Here are the two options I've thought of:
Create some rule that does prevents the user from changing this data
This seems like the natural approach for what I want to do.
Add a text field with a function mapping each number to the corresponding software
As the form is tied to the database, InfoPath wants all fields to be tied to a database value, which would require creating another database entry. I'm also having trouble finding an InfoPath function I can use to handle this mapping.
Change the radio box's variable to text values and make a text box in the new view, which can be made read-only.
I'd really prefer not to do this, as it will make things messier for other programs using this database value and seems wasteful, but if nothing else works, this seems do-able.
Is there some sort of rule/method I could use to make this radio button control read-only?
You can use conditional formatting to disable any control (including radio buttons).
To set your control to always be disabled do the following:
Right click on your control and select Conditional Formatting...
Click Add...
In the leftmost dropdown select The expression
type true() in the text field (this tells InfoPath to always apply this formatting)
Check the Disable this control checkbox.
Click OK and OK.
Note: You will need to do this for each of your radio buttons.
Also, for future reference: If you simply want to display the result of a function (such as in your second solution) you don't need to use a text box. You can use an expression box. An expression box is not necessarily linked to a field in the datasorce, so you won't need an additional column in your database for it.