Changing an existing field's format without dropping, recreating - dynamics-crm

I've tried changing the format attribute of a field (from Text to URL) without dropping the column and recreating it. I know this isn't supported, but it seemed simple so I thought I'd give it a try.
I came up with this SQL script based on this post
UPDATE Attribute SET AttributeLogicalTypeId = 'url' WHERE AttributeId in
(
SELECT AttributeId FROM Attribute ab where ab.LogicalName in ('new_linkedin') and ab.EntityId in
(Select EntityId from Entity where LogicalName in ('account', 'contact'))
)
According to the UI, when I go back in the field's configuration, this seems to have worked. But the problem is the value in the field is never turned into an actual URL, whereas the built-in field websiteurl does it properly (value turns bold and underlined).
Am I missing something else to update in the database ?

Hmm, removing the field from the form(s), publishing the form(s) and then putting the field back on the form(s) and publish yet again did it.

Related

avoid triggering auto-update and calculated fields when updating FileMaker data through JDBC

I have noticed two things I want to avoid when updating data in my FileMaker solution through JDBC:
field calculations are run while inserting/updating data, some of which considerably slow down the update process
last-modified fields are changed (but created fields are not, even on INSERT)
So I am looking for a way to update/insert through JDBC without triggering script triggers or the "changed on/by" auto-calculation. (because I am merging data from another DB and want the change fields to represent the actual last change, not the copy).
For case #2 I have tried both the built-in checkbox of changing the field when edited, and the calculated field solution with Let ( trigger = GetField ( "" ) ; If ( $$SilentSync > 0 ; Self ; Get ( CurrentDate ) ) ) as was answered, e.g. in my related question about avoiding auto-calculations when working in the solution itself. Sadly, both get triggered (and the global variable solution doesn't avoid it) when using JDBC.
Is there a way to say "don't update this field when I change it via JDBC"? Either globally or with an improved field calculation? I've searched the official JDBC guide and Google and found nothing.
For example, what would help is if using a calculated field I can somehow determine that data was changed not through the FM solution, but through JDBC.
For anyone finding this question in the future:
The solution is actually fairly simple, modifying the code snippet I posted to check for the account name instead of a global variable. As I have made a special user for JDBC access, that works well.

Add empty first row in smart field

in eclipse scout mars:
how to add empty row in smart field, so user can select nothing and he is not forced to select some value in smart field.
In sql if I add SELECT 0, '' UNION SELECT id, name FROM users...is working ok, empty row is show, but in modify value is not populated.
Thanks.
I am not sure if Eclipse Scout supports this construct of a row having an empty text.
The way to clear a value in a SmartField is to delete the text. In this case the value of the SmartField is set to null. If the value is not mandatory the user can save the form.
Can you check if this would work with your example.
Can you check if it would work if you add some text associated with your 0 value. Something like "(empty)" or "---"

Show All if parameter is null Crystal Reports

Hi everyone I use Crystal Reports with Visual Studio 2010 and have the following issue that I can't seem to solve. I have a parameter called name, and I make it so a user chooses from a drop down list of employee names. It is an optional parameter so the user can select nothing in which case I would like the report to show ALL the employees except for the rows that have field Employee name empty. Now I think I got the second part of it down, because I put a formula in the detail section that seems to hide all the empty employees. The problem is that if I leave the parameter unselected the report ONLY shows rows with field Employee name empty. I created a formula like so:
if not (hasvalue(({?Zaduzioc}))) then True
else if
hasvalue({?Zaduzioc}) then
{Inventar_Model_ReportClass.ImeZaduzioca} in {?Zaduzioc} and
{Inventar_Model_ReportClass.Status} = "Aktivno"
Now this exact same formula works for me if I use it with a different report and parameter but that parameter has no empty values so I'm guessing it equates to something like if there are empty values show only those rows if not show everything.
The problem is I can't figure out how to tell it to show everything.
Any help would be greatly appreciated.
I managed to make it work, the problem was in the edit for the parameter I didn't set optional to true, overlooked it and as soon as I did that it all worked. So to recap for anyone with this problem: Make your parameter set optional to true, and put this in the formula for record selection:
if not (hasvalue(({?Parameter}))) then True
else if
hasvalue({?Parameter}) then
{table.column} in {?Parameter}
That should be that.
If you are selecting from a dropdown, you can add an item, Value = ALL, Description = ALL. Set your default to this value. Then in the Selection Expert, add this to your selection query:
....
AND
(IF {?Parameter} = 'ALL' THEN
{databasefield} = {databasefield}
ELSE
{databasefield} = {?Parameter})

getUserBy() phpfox

During working I faced a very weird thing in phpfox script
I put in the table user a new field .. and this field is tinyint with default value 0 and started to work on giving the user the ability to insert the value through links and finally it's succeeded but when I tried to get this value by getUserBy('name_of_the_field') it gave me a null value although I checked it in the database table and found that field has a value ... so could you help me please ?!
The getUserBy() does not get every field in the user table, there is a predefined list of columns that it will fetch.
You will need to get this field in a different way or write a plug-in to the hook "user.service_auth___construct_query" so it loads your new field, I have not tried this but I believe it should work as a plug-in to that hook:
$this->database()->select('u.my_new_field,');

Entity Framework is padding out my text fields although they are not Fixed Length

I am building an MVC3 site using Entity Framework 4 and I'm having a problem with fixed length fields.
When I look at my code during debug it shows that MyEntity.Title="Hello name " with the title padded out to the maximum length of the field.
This is usually a question of having fixed field length in the EDMX file or using a char data type on the underlying database rather than a varchar. In this case neither of those is correct, however it is possible that the problem fields were of fixed length originally. I have manually changed each field in the EDMX ( and the model has been regenerated ) and the fields were never fixed length in the database ( which was the starting point for the application ) so I guess that the need to pad out the fields is being stored somewhere in the Entity Framework configuration and hasn't been updated.
The problem occurs in new records when they are added to the database- when the object is created the Title will be correct, when it is instanciated from the database it is padded.
What do I need to do in order to get rid of the padding, which is really screwing up my string comparisons unless I trim everything?
It turns out that in the .EDMX file the padded files were still listed as nchar. This wasn't visible through the Model Editor, the only way to change it was to right-click on the model in Visual Studio and select "open with..." then use an XML editor. The offending fields looked like this:
<Property Name="MyProperty" Type="nchar" Nullable="false" MaxLength="50" />
Changing the Type to nvarchar and running the template again seemed to clear the problem up.
Existing fields do not get updated in the model when you update it from the database. You either have to delete the entities from the model, or manually change those fields to the new values.
Check the property types in the Model Browser and make sure they are correct.
Change your Title field to have the Fixed Length property set equal to true. It's probably defaulting to none :)
Make sure you make the change in the dbase first and then update your edmx.

Resources