compare a number's last digits inside a relation

39 views
Skip to first unread message

Shuki Birshan

unread,
Feb 17, 2025, 7:07:11 AMFeb 17
to Migrated By Firefly
Hi, 

I have a scenario where I need to use both a regular comprehension  an expression.

something like this:

Relations.Add(Tnoot_KfilutLefiTnaim, Tnoot_KfilutLefiTnaim.MsprAsk.IsEqualTo(TnuotZmaniot_Hitzoni.MsprAsk).And(
Tnoot_KfilutLefiTnaim.TarikhAsmkta.IsEqualTo(TnuotZmaniot_Hitzoni.TarikhAsmkta)).And(
Tnoot_KfilutLefiTnaim.SkomKollMam.IsEqualTo(TnuotZmaniot_Hitzoni.SkomKollMam)).And(
()=> TnuotZmaniot_Hitzoni_KfilutLefiTnaim.Asmkta.Exp_GetSfarotAharonot() == TnuotZmaniot_Hitzoni.Asmkta.Exp_GetSfarotAharonot()).And(
Tnoot_KfilutLefiTnaim.IsKfilutSheNivdeka.IsEqualTo(false)), Tnoot_KfilutLefiTnaim.SortByChshbonOtarikhAsmkta);


the reason for this, is because I have a number column the I need to compare only it's last digits and not the entire number.

I know I can do this:
And(TnuotZmaniot_Hitzoni_KfilutLefiTnaim.Asmkta.IsEqualTo(()=> TnuotZmaniot_Hitzoni.Asmkta.Exp_GetSfarotAharonot(4)))

but it is not helpful for this situation because It compare an entire number against the last digits of the second number.

Any help would be appreciated. 

Shuki.

Noam Honig

unread,
Feb 17, 2025, 9:50:58 AMFeb 17
to Shuki Birshan, Migrated By Firefly
Hi Shuki

You can add an "expression" filter:
Relations[Tnoot_kfil...].Where.Add(()=> whatever);
There is a risk of performance,since this is done in memory on all the rows that match other filter.

Another option is to add Sql where - which will be faster

Relations[Tnoolt_kfil...].Where.Add("{1} like {2}"...)
Noam Honig  
Founder & CEO


--
You received this message because you are subscribed to the Google Groups "Migrated By Firefly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to migrated-by-fir...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/migrated-by-firefly/e166f6a4-60c6-4215-af62-ff94edbf4665n%40googlegroups.com.

Shuki Birshan

unread,
Feb 17, 2025, 1:18:07 PMFeb 17
to Migrated By Firefly
Thanks Noam,

I would like to try and avoid the expression in memory because of performance issue like you said.

the sql where is more suitable. 
I changed the syntax to:
Relations.Add(Tnoot_KfilutLefiTnaim, Tnoot_KfilutLefiTnaim.SortByChshbonOtarikhAsmkta).Where.Add(
    "{0} = {1} AND {2} = {3} AND {4} = {5} AND {6} = {7} AND {8} = 0",
    Tnoot_KfilutLefiTnaim.MsprAsk, TnuotZmaniot_Hitzoni.MsprAsk,
    Tnoot_KfilutLefiTnaim.TarikhAsmkta, TnuotZmaniot_Hitzoni.TarikhAsmkta,
    Tnoot_KfilutLefiTnaim.SkomKollMam, TnuotZmaniot_Hitzoni.SkomKollMam,
    Tnoot_KfilutLefiTnaim.Asmkta.Exp_GetSfarotAharonot(_parent.MisparSfarotAsmahta), TnuotZmaniot_Hitzoni.Asmkta.Exp_GetSfarotAharonot(_parent.MisparSfarotAsmahta),
    Tnoot_KfilutLefiTnaim.IsKfilutSheNivdeka);

but, in runtime it is translated to:
"(MsprAsk = 28 AND TarikhAsmkta = '20250101' AND SkomKollMam = 118.0 AND 0 = 0 AND  IsKfilutSheNivdeka = 0)"

the part with the method the returns the last digits of a number is not translated in runtime.
any idea why ?
'Asmkta' is a  NumberColumn   and the ' Exp_GetSfarotAharonot  ' method return a Number. 
(also tried that it will return a NumberColumn but didn't work also).

also tried ToString() for the ' Exp_GetSfarotAharonot' and use "LIKE" in the formula, but also didn't work.



ב-יום שני, 17 בפברואר 2025 בשעה 16:50:58 UTC+2, no...@fireflymigration.com כתב/ה:

Noam Honig

unread,
Feb 17, 2025, 3:36:26 PMFeb 17
to Shuki Birshan, Migrated By Firefly

Shuki Birshan

unread,
Feb 21, 2025, 3:47:37 AMFeb 21
to Migrated By Firefly

Thanks noam.
what worked for me was the combination (that I didn't know I can do):
 Relations.Add(Tnoot_KfilutLefiTnaim,Tnoot_KfilutLefiTnaim.MsprAsk.IsEqualTo(TnuotZmaniot_Hitzoni.MsprAsk).And(Tnoot_KfilutLefiTnaim.TarikhAsmkta.IsEqualTo(TnuotZmaniot_Hitzoni.TarikhAsmkta)).And(Tnoot_KfilutLefiTnaim.SkomKollMam.IsEqualTo(TnuotZmaniot_Hitzoni.SkomKollMam)).And(Tnoot_KfilutLefiTnaim.IsKfilutSheNivdeka.IsEqualTo(false)), Tnoot_KfilutLefiTnaim.SortByChshbonOtarikhAsmkta).Where.Add(
                        ()=> Tnoot_KfilutLefiTnaim.Asmkta.Exp_GetSfarotAharonot(_parent.MisparSfarotAsmahta) == TnuotZmaniot_Hitzoni.Asmkta.Exp_GetSfarotAharonot(_parent.MisparSfarotAsmahta));
ב-יום שני, 17 בפברואר 2025 בשעה 22:36:26 UTC+2, no...@fireflymigration.com כתב/ה:
Reply all
Reply to author
Forward
0 new messages