Key mismatch on column with value 0 - loopbackjs

Firt of all, thank you for using your time and reading my question.
Secondly, I would like to receive some help from you to fix a relational error with two entities in loopback.
The error I'm facing is the next one;
Key mismatch: OpsItinerary.itinerary_status_ind: 0, GenIndicatorValue.ind_value: 0
For some reasons, loopback cannot create a relation since the source and target value starts with 0, the identity value should be greater than that. I have some other relations with this target entity with values like 1 or 2 and the api performs exactly as I expect.
Is there any workaround to show the results expected since the relation is tested with another values (greater than 0) and it's working fine?
Thanks in advance.

Sounds like a bug. Please file an issue at https://github.com/strongloop/loopback/issues

Related

strange DataFormat.Error: We couldn't convert to Number. Details: nan

DataFormat.Error: We couldn't convert to Number
Details: nan
I keep getting above error and I just can't get it solved.
The same error message appears both when:
I try to perform Table.ExpandTableColumn
try to filter only rows with errors
same error whether I specify column(s) in table.selectrowswitherrors or not
I don't expect this table to contain errors, however that case it should just return empty table (and it indeed does for other tables)
I don't have any division in my data model, so it's really strange how nan could distributed (it's the result of 0/0 in Power Query)
update
It seems I've some corrupted rows in my source data, by filtering down my table, there is a row with "Error" at the bottom:
Unfortunately I can't see it's details as clicking on one of the "Error"s gives error message:
Also when I try to remove errors, that row is still not removed:
The source data is in Excel (200k+ rows), I removed all empty rows below the used range in case there would be an extra row used there which cause the issue, but it didn't help.
Finally I could solve the problem by adding RemoveRowsWithErrors much earlier in the code, when the error was present only in one column and not propagated to the whole row.
As its suggested also here: https://app.powerbi.com/groups/me/apps/3605fd5a-4c2e-46aa-bee9-1e413fc6028a/reports/dd7a5d70-dca1-44c5-a8f4-7af5961fe429/ReportSection

AWS Quicksight calculated fields gives incorrect result for simple division

I have a dataset with fields targeted and opens and I need to add calculated field opens per targeted which essentially means doing simple devision of those 2 values.
My calculated field is as follows
{opens}/{targeted}
but then displaying simple table with values they are completely incorrect
If I try any other operator like + * etc calculations are correct.
I'm completely out of ideas on how to debug this. I've simplified the dataset to just columns of targeted and opens, can't get any simpler.
Had the same problem, I fixed it by wrapping the columns with the sum() function. Like this:
sum({opens})/sum({targeted})
I think you need to make AWS understand that you are working with float numbers.
1.0*{opens}/{targeted}
if still not working try also
(1.0*{opens})/({targeted}*1.0)
it should give you the desired output (not tested, let me know if it doesnt work)

Sitecore Profile.Score(string, float) having issues with decimal values

I am working on a sitecore site rev 120706 DMS and main.
We are adding personas to some pages and getting unusual results with fractional values when we try to add to them using the Score(string, float) method. we have a value lead which is 0.5 due to two profiles being added to an earlier page one with a value of 1 and another with a value of 0. On a form submission we want to add one to the value and use Profile.Score("lead", 1) which replaces the .5 with a 1 instead of adding 1 to get 1.5 . When the value is 1 we are successfully getting 2.
How can we get the Score method to react in a consistent matter?
Sitecore apparently has an issue in their code with it using int.Parse instead of float.Parse
I've found place in the code where the error appears. It's in the
Sitecore.Analytics.Data.VisitProfile.Parse() method. It uses int.Parse
instead of float.Parse while reading profile values from database.
This issue was fixed in Sitecore 6.6.0 Update-4. Please see reference
number 376088 in release notes. Unfortunately, there is no easy way to
fix the code. Please consider upgrading your solution to 6.6.0
Update-4. In the meantime I would suggest to use larger score values
in your profiles, so that resulting value is always be greater than 1.
This approach works on my side. Please let us know in case you have
any troubles with that.
To resolve the issue ended up just multiplying the values we were using by 10 to avoid sitecore's int as opposed to float issue.

wxChoice::SetString() Index Error

I've finally gotten around to messing with the wxChoice control in my application, and for some reason whenever I attempt to modify the text of a column, I get the error:
....\src\msw\choice.cpp(348): assert "IsValid(n)" failed in
wxChoice::SetString(): invalid item index in wxChoice::SetString
The error itself makes it quite obvious that the item index isn't valid, but based off of my code and the (not very descriptive) documentation, I should only need to set the number of columns, then I'd be allowed to edit the text at a given index.
Here's a snippet from my project:
int phones = Phones->size();
choiceDevice->SetColumns(phones); // Value greater than 0
choiceDevice->SetString(phones - 1, pInstance->ProfileName); // Should assign the last index the value of the ProfileName.
What if Phones is empty, and thus phones == 0?
wxChoice::SetColumns
Remarks:
This is implemented for GTK and Motif only and doesn’t do anything under other platforms.
It looks like SetColumns is used for multi-column choice control, I have never seen it. Anyway, it doesn't add new items to the control. In Windows it does nothing in any case.
As Alex had said, I shouldn't be using wxChoice::SetColumns on Windows since it has no affect. I found that I have to use wxChoice::Append instead of setting the number of columns, then setting the individual string.

"out of memory" exception in CRecordset when selecting a LONGTEXT column from MySQL

I am using CODBCRecordset (a class found on CodeProject) to find a single record in a table with 39 columns. If no record is found then the call to CRecordset::Open is fine. If a record matches the conditions then I get an Out of Memory exception when CRecordset::Open is called. I am selecting all the columns in the query (if I change the query to select only one of the columns with the same where clause then no exception).
I assume this is because of some limitation in CRecordset, but I can't find anything telling me of any limitations. The table only has 39 columns.
Has anyone run into this problem? And if so, do you have a work around / solution?
This is a MFC project using Visual Studio 6.0 if it makes any difference.
Here's the query (formatted here so wold show up without a scrollbar):
SELECT `id`, `member_id`, `member_id_last_four`, `card_number`, `first_name`,
`mi`, `last_name`, `participant_title_id`, `category_id`, `gender`,
`date_of_birth`, `address_line_1`, `address_line_2`, `city`, `state`,
`zip`, `phone`, `work_phone`, `mobile_phone`, `fax`, `email`,
`emergency_name`, `emergency_phone`, `job_title`, `mail_code`,
`comments`, `contract_unit`, `contract_length`, `start_date`,
`end_date`, `head_of_household`, `parent_id`, `added_by`, `im_active`,
`ct_active`, `organization`, `allow_members`, `organization_category_id`,
`modified_date`
FROM `participants`
WHERE `member_id` = '27F7D0982978B470C5CF94B1B833CC93F997EE23'
Copying and pasting into my query browser gives me only one result.
More info:
Commented out each column in the select statement except for id. Ran the query and no exception.
Then I systematically went through and uncommented each column, one at a time, and re-ran query in between each uncomment.
When I uncomment the comment column then I get the error.
This is defined as the following (Using MySQL): LONGTEXT
Can we assume you mean you're calling CODBCRecordset::Open(), yes? Or more precisely, something like:
CDatabase db;
db.Open (NULL,FALSE,FALSE,"ODBC;",TRUE);
CODBCRecordSet rs (&db);
rs.Open ("select blah, blah, blah from ...");
EDIT after response:
There are some known bugs with various ODBC drivers that appear to be caused by retrieving invalid field lengths. See these links:
http://forums.microsoft.com/msdn/showpost.aspx?postid=2700779&siteid=1
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=296391
This particular one seems to have been because CRecordset will allocate a buffer big enough to hold the field. As the column returns a length of zero, it's interpreted as the max 32-bit size (~2G) instead of the max 8-bit size (255 bytes). Needless to say, it can't allocate enough memory for the field.
Microsoft has acknowledged this as a problem, have a look at these for solutions:
http://support.microsoft.com/kb/q272951/
http://support.microsoft.com/kb/940895/
EDIT after question addenda:
So, given that your MySQL field is a LONGTEXT, it appears CRecordSet is trying to allocate the max possible size for it (2G). Do you really need 2 gig for a comments field? Typing at 80 wpm, 6cpw would take a typist a little over 7 years to fill that field, working 24 h/day with no rest :-).
It may be a useful exercise to have a look at all the columns in your database to see if they have appropriate data types. I'm not saying that you can't have a 2G column, just that you should be certain that it's necessary, especially in light of the fact that the current ODBC classes won't work with a field that big.
Read Pax's response. It gives a you a great understanding about why the problem happens.
Work Around:
This error will only happen if the field defined as (TEXT, LONGTEXT, etc) is NULL (and maybe empty). If there is data in the field then it will only allocate for the size the data in the field and not the max size (thereby causing the error).
So, if there is a case where you absolutely have to have these large fields. Here is a potential solution:
Give the field a default value in the database. (ie. '<blank>')
Then when displaying the value; you pass NULL/empty if you find default value.
Then when updating the value; you pass the default value if you find NULL/empty.
I second Pax's suggestion that this error is due to trying to allocate a buffer big enough to hold the biggest LONGTEXT possible. The client doesn't know how large the data is until it has fetched it.
LONGTEXT is indeed way larger than you would ever need in most applications. Consider using MEDIUMTEXT (max size 16MB) or just TEXT (max size 64KB) instead.
There are similar problems in PHP database interfaces. A PHP normally has a memory size limit and any fetch of a LONGBLOB or LONGTEXT is likely to exceed that limit.